Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Inser row with the format from the row above.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Inser row with the format from the row above.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Inser row with the format from the row above.

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Inser row with the format from the row above.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Inser row with the format from the row above.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Inser row with the format from the row above.

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


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Inser row with the format from the row above.


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







  #11   Report Post  
Posted to microsoft.public.excel.programming
lwm lwm is offline
external usenet poster
 
Posts: 38
Default Inser row with the format from the row above.

Thanks Don

"Don Guillett" wrote:


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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Block inser or delete rows Prema Excel Programming 0 January 17th 06 08:19 AM
VBA Inser a new Row Joel Excel Discussion (Misc queries) 0 January 15th 06 01:21 AM
Inser a page number in MS Excel Arindam Maitra Excel Discussion (Misc queries) 1 October 28th 05 03:41 PM
Best way to inser file property into and excel sheet (cell) Luc Excel Discussion (Misc queries) 3 July 5th 05 08:36 PM
Formulas: Keeping same row/column reference when columns are inser Mike Excel Discussion (Misc queries) 5 February 11th 05 09:37 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"