Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code but needs some help tricking it.
Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will paste the formats from the last line to a new line below. Adapt to
suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, but that insert a row around 20 (A20?) I need to insert the row after
D34. Thanks "Don Guillett" wrote: This will paste the formats from the last line to a new line below. Adapt to suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don
I know you wrote this for pgarcia bt I tried it and it alwasy goes to A1. If I try at A10 it still goes to A1. How owuld I change this to work at any row. Thanks "Don Guillett" wrote: what's in d33 d34 d35 -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... Thanks, but that insert a row around 20 (A20?) I need to insert the row after D34. Thanks "Don Guillett" wrote: This will paste the formats from the last line to a new line below. Adapt to suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() IF? you want to copy formats from the active cell row to the next row you could just modify to Sub NewLine() lr = activecell.row 'Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "lwm" wrote in message ... Don I know you wrote this for pgarcia bt I tried it and it alwasy goes to A1. If I try at A10 it still goes to A1. How owuld I change this to work at any row. Thanks "Don Guillett" wrote: what's in d33 d34 d35 -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... Thanks, but that insert a row around 20 (A20?) I need to insert the row after D34. Thanks "Don Guillett" wrote: This will paste the formats from the last line to a new line below. Adapt to suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using your variable:
ActualRow.Offset(1, 0).Row.Insert ActualRow.Copy ActualRow.Offset(1, 0) "pgarcia" wrote: Thanks, but that insert a row around 20 (A20?) I need to insert the row after D34. Thanks "Don Guillett" wrote: This will paste the formats from the last line to a new line below. Adapt to suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fix the syntax error.
ActualRow.Offset(1, 0).EntireRow.Insert ActualRow.Copy ActualRow.Offset(1, 0) "JLGWhiz" wrote: Using your variable: ActualRow.Offset(1, 0).Row.Insert ActualRow.Copy ActualRow.Offset(1, 0) "pgarcia" wrote: Thanks, but that insert a row around 20 (A20?) I need to insert the row after D34. Thanks "Don Guillett" wrote: This will paste the formats from the last line to a new line below. Adapt to suit Sub NewLine() lr = Cells(Rows.Count, "a").End(xlUp).Row Rows(lr).Copy Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Forgot to add, the sheet is password proteced.
Thanks "pgarcia" wrote: I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
unprotect
code protect -- Don Guillett Microsoft MVP Excel SalesAid Software "pgarcia" wrote in message ... Forgot to add, the sheet is password proteced. Thanks "pgarcia" wrote: I have the following code but needs some help tricking it. Private Sub CommandButton1_Click() ActualRow = Selection.Row Cells(ActualRow + 1, 1).EntireRow.Insert Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _ Destination:=Cells(ActualRow + 1, 1) End Sub 1. I need to start in cell D34 2. Copy the format in D34 to new row Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Block inser or delete rows | Excel Programming | |||
VBA Inser a new Row | Excel Discussion (Misc queries) | |||
Inser a page number in MS Excel | Excel Discussion (Misc queries) | |||
Best way to inser file property into and excel sheet (cell) | Excel Discussion (Misc queries) | |||
Formulas: Keeping same row/column reference when columns are inser | Excel Discussion (Misc queries) |