owentmoore
Technical User
Hi all
I have the following code which searches through each row in turn looking for the first occurence of a comma. It then enters the cell location of this comma in a cell on the same row.
I have approx 1700 rows to search which is taking a long time. But if I filter by only the required cells to hide the cells I don't need then this qty goes down to approx 200 rows.
Is there a way to run this code on visible cells only? I could use advanced filter if necessary but If I can get around this and speed up the code at the same time all the better!!
I have the following code which searches through each row in turn looking for the first occurence of a comma. It then enters the cell location of this comma in a cell on the same row.
I have approx 1700 rows to search which is taking a long time. But if I filter by only the required cells to hide the cells I don't need then this qty goes down to approx 200 rows.
Is there a way to run this code on visible cells only? I could use advanced filter if necessary but If I can get around this and speed up the code at the same time all the better!!
Code:
With ActiveSheet
Do
With ActiveSheet.Range(strColQTY10 & lRow1 & ":" & strColQTY & lRow1)
If lRow1 < lRow2 Then
Range(strColQTY & lRow1).Select
Set strSearch = .Find(",", AFTER:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
If Not strSearch Is Nothing Then
firstaddress = strSearch.Address
lCol2 = Worksheets("Summary Data").Cells.Find(What:="SS Cover Process, Qty", AFTER:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Column
strColQTY2 = Split(Mid(Columns(lCol2).Address, 2), ":")(0)
Range(strColQTY2 & lRow1).Select
ActiveCell.Formula = "=" & firstaddress
Else: GoTo SkipCell
End If
SkipCell:
lRow1 = lRow1 + 1
End If
End With