Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last Entry, add row below + copy formulae and formats from ra
I want a macro to look in column A, find the last entry "F", then to insert a
row below this and copy all formatting and formulae from named range "Freehold" into this row, leaving the cursor in column C where user would start inputting data. Could someone please help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last Entry, add row below + copy formulae and formats from ra
Paste this in a general module and it will work on the active worksheet:
Sub addafterlastF() Dim LastRow As Long LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row For x = LastRow To 1 Step -1 Cells(x, 1).Select b = ActiveCell.Text If b = "F" Then Cells(x + 1, 1).Select Selection.Insert Shift:=xlDown Range("Freehold").Select Selection.Copy Cells(x + 1, 1).Select ActiveSheet.Paste End If Next Cells(1, 3).Select End Sub Will that do? Mike "Karen McKenzie" wrote: I want a macro to look in column A, find the last entry "F", then to insert a row below this and copy all formatting and formulae from named range "Freehold" into this row, leaving the cursor in column C where user would start inputting data. Could someone please help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last Entry, add row below + copy formulae and formats fro
That works great, thanks. Only thing I need to change is that "Freehold" is
within a range of hidden rows. As we've copied the format, the rows inserted are also hidden. How do I overcome this? "Mike" wrote: Paste this in a general module and it will work on the active worksheet: Sub addafterlastF() Dim LastRow As Long LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row For x = LastRow To 1 Step -1 Cells(x, 1).Select b = ActiveCell.Text If b = "F" Then Cells(x + 1, 1).Select Selection.Insert Shift:=xlDown Range("Freehold").Select Selection.Copy Cells(x + 1, 1).Select ActiveSheet.Paste End If Next Cells(1, 3).Select End Sub Will that do? Mike "Karen McKenzie" wrote: I want a macro to look in column A, find the last entry "F", then to insert a row below this and copy all formatting and formulae from named range "Freehold" into this row, leaving the cursor in column C where user would start inputting data. Could someone please help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find & copy data from most recent entry | Excel Discussion (Misc queries) | |||
Copy formats and formulae from 1 worksheet to all worksheets in f | Excel Discussion (Misc queries) | |||
Conditional Formats for formulae and values | Excel Worksheet Functions | |||
If formulae using formats | Excel Worksheet Functions | |||
multi formulae data entry | Excel Programming |