Hi.
I need to select the rows in my sheet without background color and I do that, with this code snippet, but I can't figure out how to apply my new Range to a Select. Anyone?
Code:
Dim strRange As String
Range("A1").CurrentRegion.Select
With Selection
For Each r In .Rows
If r.Interior.ColorIndex = xlColorIndexNone Then
strRange = strRange & returnRangeForRow(r.Address) & ", "
End If
Next r
End With
strRange = Right(strRange, (Len(strRange) - 1))
Public Function returnRangeForRow(ByVal strRange As String)
strRange = Right(strRange, (Len(strRange) - InStrRev(strRange, "$"))) '"$A$38"
strRange = strRange & ":" & strRange '"38"
returnRangeForRow = strRange '"38:38"
End Function
I tried a million things that I won't list here but I can say it's not as easy as typing: Range("1" & strRange).Select
Selection.Offset(0, 1).Select
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
- mega
Moving to C# .NET