Leah Ahuva
New Member
- Joined
- Jun 24, 2008
- Messages
- 4
My macro almost does everything I want except hide all the rows starting with the first T row in a particular column.
I am able to find that cell, but I then need to use the the cell number in my Rows select statement. Also when I try to use the variable LastRow, which works elsewhere in my code ( Selection.AutoFill Destination:=Range("E2:E" & LastRow), Type:=xlFillDefault) it does not work:
' Rows("26:LastRow & ").Select
' Rows("26:LastRow").Select
Rows("26:29").Select (Only this hardcode version works)
Ideally I want a variable for the 26 ( the first T row) and the 29.
Here is some of the code:
Sub provision_prepare()
stuff
LastRow = Range("A" & Rows.Count).End(xlUp).Row
stuff
Selection.AutoFill Destination:=Range("E2:E" & LastRow),
Selection.Find(What:="T", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
Somehow use the above selection to find the row number.
More stuff
The commented out statements my code returns with an error message, "Type Mismatch", even though in the little window I see 29 for LastRow (which is variant long but when I made it an integer I still got the same message),
' Rows("26:LastRow & ").Select
' Rows("26:LastRow").Select
Rows("26:29").Select
More Stuff
End Sub
I would be happy to read an article on this, but I cannot seem to find one on this specific subject. Probably I am not doing a meaningful google.
Is there anyone out there that can help me? Our programmer just resigned and they have not hired another yet. I mostly do sql querying for a living not "real" programming.
Thanks.
I am able to find that cell, but I then need to use the the cell number in my Rows select statement. Also when I try to use the variable LastRow, which works elsewhere in my code ( Selection.AutoFill Destination:=Range("E2:E" & LastRow), Type:=xlFillDefault) it does not work:
' Rows("26:LastRow & ").Select
' Rows("26:LastRow").Select
Rows("26:29").Select (Only this hardcode version works)
Ideally I want a variable for the 26 ( the first T row) and the 29.
Here is some of the code:
Sub provision_prepare()
stuff
LastRow = Range("A" & Rows.Count).End(xlUp).Row
stuff
Selection.AutoFill Destination:=Range("E2:E" & LastRow),
Selection.Find(What:="T", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
Somehow use the above selection to find the row number.
More stuff
The commented out statements my code returns with an error message, "Type Mismatch", even though in the little window I see 29 for LastRow (which is variant long but when I made it an integer I still got the same message),
' Rows("26:LastRow & ").Select
' Rows("26:LastRow").Select
Rows("26:29").Select
More Stuff
End Sub
I would be happy to read an article on this, but I cannot seem to find one on this specific subject. Probably I am not doing a meaningful google.
Is there anyone out there that can help me? Our programmer just resigned and they have not hired another yet. I mostly do sql querying for a living not "real" programming.
Thanks.