Search : in
By :

Macro, Range Selection

Last answer on Nov 6, 2009 9:00:16 pm GMT OT, on Feb 25, 2009 8:47:24 am GMT 
 Report this message to moderators

Hello,

I have a macro that chooses dates from a field which is a general download from our information system. It then sorts the dates Ascending, and puts in a True False formula to see if any of the dates are repeated. It then copy pastes values the TRUE and falses so that when you sort, the formula does not relaclulate. It then sorts by TRUE / FALSE to get a resulting list of which dates are not repeated: represented by the FALSEs.

Resulting Table may look something like this:
23/02/2009 FALSE
24/02/2009 FALSE
25/02/2009 FALSE
26/02/2009 FALSE
27/02/2009 FALSE
28/02/2009 FALSE
01/03/2009 FALSE
23/02/2009 TRUE <--(First date that repeats)
23/02/2009 TRUE
23/02/2009 TRUE
23/02/2009 TRUE
23/02/2009 TRUE

I want to then add into the macro code to select the range of only the dates which do not repeat, the FALSE dates. I dont think any of the .SpecialCells methods will work, since I've tried many of them. Any help would be grand.

Configuration: Windows XP
Internet Explorer 6.0

Best answers for « Macro, Range Selection » in :
Excel – Macro for copy & paste selected range ShowExcel – Macro for copy & paste selected range Issue Solution Note Issue I have a summary of data by month in one sheet and the raw data in another sheet. Instead of creating multiple worksheets for my raw data for each month, I want...
[VBA] Deleting a word in a range of cell Show[VBA] Deleting a word in a range of cell In the case you want to delete a word in a sentence, just create a small macro that removes the word. But it will become difficult when you have word like, for example, "Theword" or "THEWORD" or...
Excel – Macro to detect and hide blank rows ShowExcel – Macro to detect and hide blank rows Issue Solution Note Issue I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...
Spreadsheets - Cell Selection ShowCell Selection Spreadsheets are powerful tools for working with data. However, to work with data, it is necessary to have tools to rapidly choose the required cells. Line Selection An entire line can be chosen by clicking directly on the line...

1

WutUp WutUp, on Feb 25, 2009 9:00:58 pm GMT

This code will put a thin style border around the date, Column A and "FALSE", Column B.
I don't know what you want to do exactly, but this gives you an idea of how to select the cells with "FALSE".
Hope this helps!


Dim r
Dim intLastRow As Integer
Dim intRow As Integer
r = Range("A65536").End(xlUp).Row
intLastRow = r

For intRow = 1 To intLastRow

Rows(intRow).Select

If Cells(intRow, 2) = "FALSE" Then

Range(Cells(intRow, 1), Cells(intRow, 2)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone

End If

Next intRow

Range("A1").Select

Reply to WutUp WutUp

2

 User1, on Nov 6, 2009 9:00:16 pm GMT

Say that the column containing "True" or "False" is column B. You could create another adjacent column C with the following formula, say for row 1, =If(B1="False",1/0,1). Then fill this formula down. While the cells in Column C are highlighted, hit Edit > Goto > Special Cells > Errors. Then you can use the reference: Selection.Offset(0,-1).Select, and voila you have selected the cells that contain the word "False".

Reply to User1