S
Sheela
Hi I have following code to search and for specific words and then delete the
rows between ( including them) those rows.
This macro works fine on a XP machine, but not working properly on Vista.
While debugging the code by “step intoâ€, I realized the “WS. Find†function
not finding the rows, even though those words are exist in the first column.
I am trying modify the code to other than “WS.columns.find†function, but
can you help me to find out why it is not working on Vista, the way it is
supposed to be?
thank you so much for your help
########
Public Sub Paste_Transpose_Specific()
Dim WS As Worksheet
Dim Trialrow, Summaryrow As Range
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
With WS
Set Trialrow = WS.Columns(1).Find("Sample", Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlNext)
Set Summaryrow = WS.Columns(1).Find("Total:", Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If Not (Trialrow Is Nothing) And Not (Summaryrow Is Nothing) Then _
WS.Rows(Trialrow.Row & ":" & Summaryrow.Row).Delete
End With
Next WS
On Error GoTo 0
rows between ( including them) those rows.
This macro works fine on a XP machine, but not working properly on Vista.
While debugging the code by “step intoâ€, I realized the “WS. Find†function
not finding the rows, even though those words are exist in the first column.
I am trying modify the code to other than “WS.columns.find†function, but
can you help me to find out why it is not working on Vista, the way it is
supposed to be?
thank you so much for your help
########
Public Sub Paste_Transpose_Specific()
Dim WS As Worksheet
Dim Trialrow, Summaryrow As Range
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
With WS
Set Trialrow = WS.Columns(1).Find("Sample", Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlNext)
Set Summaryrow = WS.Columns(1).Find("Total:", Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If Not (Trialrow Is Nothing) And Not (Summaryrow Is Nothing) Then _
WS.Rows(Trialrow.Row & ":" & Summaryrow.Row).Delete
End With
Next WS
On Error GoTo 0