ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   R/T 438 (https://www.excelbanter.com/excel-programming/375380-r-t-438-a.html)

Jim May

R/T 438
 
The below code is bombing on line:
v = Application.WorksheetFunction.Left(v, Len(v) - 1)

Not sure if the later two lines will work or not

Sub tester()
Dim v As String
Dim Rng As Range
Set Rng = Range("A2:A16")
For Each cell In Rng
If cell.Value = "9/15/2006" Then
v = v + cell.Address & ","
End If
Next
'need to remove the last "," assigned to my v next
v = Application.WorksheetFunction.Left(v, Len(v) - 1)
Set Rng1 = Range(v)
Rng1.Entirerow.select
End Sub

Any help appreciated.



Stefi

R/T 438
 
Omit WorksheetFunction! VBA has its own LEFT function!

Regards,
Stefi


€˛Jim May€¯ ezt Ć*rta:

The below code is bombing on line:
v = Application.WorksheetFunction.Left(v, Len(v) - 1)

Not sure if the later two lines will work or not

Sub tester()
Dim v As String
Dim Rng As Range
Set Rng = Range("A2:A16")
For Each cell In Rng
If cell.Value = "9/15/2006" Then
v = v + cell.Address & ","
End If
Next
'need to remove the last "," assigned to my v next
v = Application.WorksheetFunction.Left(v, Len(v) - 1)
Set Rng1 = Range(v)
Rng1.Entirerow.select
End Sub

Any help appreciated.





All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com