Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
thanks for the help in the past.
I have a spreadsheet that I want to find a statement like "section 1" that could change the line it is on then backup two line and insert a line or maybe 5 lines. I have tried to record a macro but it keeps selecting the line and I thought there was an offset command in VB? Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range("A8").Select Selection.EntireRow.Insert |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Don
You are selecting A8 each time before inserting. Change code to Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.EntireRow.Insert -- Regards Roger Govier "Don" wrote in message ... thanks for the help in the past. I have a spreadsheet that I want to find a statement like "section 1" that could change the line it is on then backup two line and insert a line or maybe 5 lines. I have tried to record a macro but it keeps selecting the line and I thought there was an offset command in VB? Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range("A8").Select Selection.EntireRow.Insert |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Roger, I will give it a shot. appreciate the help
"Roger Govier" wrote: Hi Don You are selecting A8 each time before inserting. Change code to Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.EntireRow.Insert -- Regards Roger Govier "Don" wrote in message ... thanks for the help in the past. I have a spreadsheet that I want to find a statement like "section 1" that could change the line it is on then backup two line and insert a line or maybe 5 lines. I have tried to record a macro but it keeps selecting the line and I thought there was an offset command in VB? Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range("A8").Select Selection.EntireRow.Insert |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you use the Relative References button when recording you should get the
Offset code. Gord Dibben MS Excel MVP On Fri, 27 Jun 2008 04:39:01 -0700, Don wrote: Thanks Roger, I will give it a shot. appreciate the help "Roger Govier" wrote: Hi Don You are selecting A8 each time before inserting. Change code to Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.EntireRow.Insert -- Regards Roger Govier "Don" wrote in message ... thanks for the help in the past. I have a spreadsheet that I want to find a statement like "section 1" that could change the line it is on then backup two line and insert a line or maybe 5 lines. I have tried to record a macro but it keeps selecting the line and I thought there was an offset command in VB? Columns("A:A").Select Selection.Find(What:="Section 1", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range("A8").Select Selection.EntireRow.Insert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to insert blank line when lines sum to zero | Excel Discussion (Misc queries) | |||
Insert blank line macro | Excel Worksheet Functions | |||
Macro Line Insert | Excel Discussion (Misc queries) | |||
Insert each line in a new row | Excel Discussion (Misc queries) | |||
Insert Line Macro | Excel Discussion (Misc queries) |