Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Good afternoon!
I know there are several posts already about this subject, but I can't seem to make any of the previous answers work. I am trying to insert a row after a given number defined by "INSERTPT" then copy data into the new row. (Column A has a list of record numbers...INSERTPT is a user defined record number) With the following code, the data gets pasted wherever the last selection was made in that worksheet. (Most of the time, the previously run macro will have the user defined record number highlighted, so this macro pastes right over it, rather than adding a row and pasting under it.) Thanks for any help! Sheets("Update TEMP").Select Range("A3").Select INSERTPT = ActiveCell.Value Sheets("Update TEMP").Select Rows("8:8").Select Range("I8").Activate Selection.Copy Sheets("Incom Inspect Report (IIR)").Select Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = iLastRow To 1 Step 1 If Cells(i, 1).Value = INSERTPT Then Rows(i + 1).EntireRow.Insert End If Next i Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |