Hi,
Im new to Macros. Im trying to find a string of text assign that to be the top of the data and then find a different string and assign that to be the bottom of the data.
Then run a loop whilst inside that data range. Am i going about it the right way?
Attached is a sample data file. Any help would be appreciated. I have made the parts that arent working into comments.
Thanks, Mat
Selection.Find(What:="Price Level", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Dim TopRow As String
ActiveCell.Select
'Name the top of the data (the first "Price Level that has just been found)
TopRow = ActiveCell
Selection.Cut Destination:=ActiveCell.Offset(1, -1).Range("A1")
ActiveCell.Offset(1, -1).Range("A1").Select
ActiveCell.Columns("b:b").EntireColumn.Select
Selection.Find(What:="Report Totals", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Dim BottomRow As String
ActiveCell.Select
BottomRow = ActiveCell
Selection.Cut Destination:=ActiveCell.Offset(1, -1).Range("A1")
ActiveCell.Offset(1, -1).Range("A1").Select
' ActiveWorkbook.Names.Add Name:="DataRange", RefersTo:="TopRow: BottomRow"
' DataRange = Range("TopRow:BottomRow").Select
' Do While Range("DataRange")
ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
Selection.Find(What:="Price Level", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
Selection.Cut Destination:=ActiveCell.Offset(1, -1).Range("A1")
ActiveCell.Offset(1, -1).Range("A1").Select
' Loop
' Wend
Bookmarks