Whats wrong in this code
Hi All,
I am not able to get what i want to be from this code, this did not give me any error, however it also did not solve my purpose. there might be something with the line: Rng = ("A" & i & ":" & "D" & i). please help.
Sub test()
Dim FindString As String
Dim Rng As Range
Dim c As Range
Dim i As Integer
i = 1 'start row number
For Each c In Range(ActiveSheet.Range("C1"), ActiveSheet.Range("C65536").End(xlUp)).Cells
If Cells(i, 3) = "abcd 1234 POSTED TO G/L" Then
Rng = ("A" & i & ":" & "D" & i)
Rng.Interior.ColorIndex = 4
End If
i = i + 1
Next c
End Sub
Sub test() Dim c As Range Dim
Sub test()
Dim c As Range
Dim i As Integer
i = 1 'start row number
For Each c In Range(ActiveSheet.Range("C1"), ActiveSheet.Range("C100").End(xlUp)).Cells
If Cells(i, 3).Value = "abcd 1234 POSTED TO G/L" Then
Cells(i, 3).Interior.ColorIndex = 4
End If
i = i + 1
Next c
End Sub
Why are you not using
Why are you not using conditional formatting?
Nick, I personally wouldn't
Nick, I personally wouldn't use conditional formatting because it looks like he wants to check all 65560 rows which would be a significant drain on processing. Also, it looks like a one shot deal and a sub that can find the appropriate lines can be subsequently amended to perform additional tasks..... On the other hand, I may just misunderstand the requirements as usual :-)
Hi Experts, thank you for
Hi Experts, thank you for your replies. is it possible in the above code to search for a string rather than a fixed text "abcd posted to G/L".
Certainly is.. You just need
Certainly is..
You just need to declare a string variable in your declarations and then set the value in your program ..
e.g
Sub test()
Dim SearchTxt as string
.....
.....
searchtxt = "abcd posted to G/L"