Dan E said:
Many thanks again, Bob (please see my Big thank-you in the "Sub gives
error..." posting - thread beginning 1/28)
I did Dan, we all appreciated it.
Bob - in a number of workbooks - worksheets, I need to select a whole bunch
of non-continguous cells in a given column, then exit the macro and apply
various formatting commands to the selection - i.e. NOT apply the formatting
within the macro. Is there a simple way to run this sub, but end up with
all the selected cells still selected when the macro exits, so I can work on
the selection?
Using my orinial code, just add a select at the end, like so
Sub myRows()
Dim cLastRow As Long
Dim i As Long
Dim rng As Range
cLastRow = Cells(Rows.Count,"AT").End(xlUp).Row
For i = 1 To cLastRow
If Cells(i, "AT").Value = "X" Then
If rng Is Nothing Then
Set rng = Cells(i,"Z")
Else
Set rng =Union(rng, Cells(i,"Z"))
End If
End If
Next i
If Not rng Is Nothing Then
rng.Font.Bold = True
rng.Select
End If
End Sub
Today, I'm going to buy a book on VBA / macros... I just
haven't found anthing on the web that teaches and is a decent cheat sheet.
Don't know what level you consider yourself at, but I would suggest, in
ascending order of development
Excel VBA Programming For Dummies - John Walkenbach
Excel 2003 Power Programming With VBA - JW again
Excel 2002 VBA Programmers Reference; John Green, Stephen Bullen, Rob Bovey,
Robert Rosenberg - (avoid the 2003 version , it has been messed up).
So I may not be bugging you guys so often in future
That's why we are here

.