Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Insert row and fill down formulae

Hi all,

I normally don't dabble in VBA / Macros as I feel out of my depth. However
I would like to set up a "hopefully simple" macro and need your assistance.

I have a formula in column R and column S. What I would like to do is
create a macro to:
1) Insert a row from the current position - Inserting a row will never be at
the first or the last row; always somewhere in the middle
2) Copy (or fill down) the formulae from columns R & S in the row above.

I hope this makes sense.
PS - I have found threads that could theoretically help, except for the fact
that I have breaks in rows between different sets of data - for example, I
have 10 rows of data, a break of a few rows, then another 10 rows of data.
The break of a few rows are blank and should hopefully remain so.

Many thanks for your help,
Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Insert row and fill down formulae

This assumes the user will select a cell somewhere on the sheet for the row
to be inserted. To assign this to a button, first create the button from
the Control Tool Box,
rightclick the button, then click view code from the pop up menu. Paste the
code below into the code window.

Private Sub Commandbutton1_Click()
Rows(ActiveCell.Row).Insert
Range("R" & ActiveCell.Row - 1 & _
":S" & ActiveCell.Row - 1).Copy
Range("R" & ActiveCell.Row).PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End Sub


"Simon" wrote in message
...
Hi all,

I normally don't dabble in VBA / Macros as I feel out of my depth.
However
I would like to set up a "hopefully simple" macro and need your
assistance.

I have a formula in column R and column S. What I would like to do is
create a macro to:
1) Insert a row from the current position - Inserting a row will never be
at
the first or the last row; always somewhere in the middle
2) Copy (or fill down) the formulae from columns R & S in the row above.

I hope this makes sense.
PS - I have found threads that could theoretically help, except for the
fact
that I have breaks in rows between different sets of data - for example, I
have 10 rows of data, a break of a few rows, then another 10 rows of data.
The break of a few rows are blank and should hopefully remain so.

Many thanks for your help,
Simon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Insert row and fill down formulae

Many thanks, this is exactly what I needed. Most kind.

"JLGWhiz" wrote:

This assumes the user will select a cell somewhere on the sheet for the row
to be inserted. To assign this to a button, first create the button from
the Control Tool Box,
rightclick the button, then click view code from the pop up menu. Paste the
code below into the code window.

Private Sub Commandbutton1_Click()
Rows(ActiveCell.Row).Insert
Range("R" & ActiveCell.Row - 1 & _
":S" & ActiveCell.Row - 1).Copy
Range("R" & ActiveCell.Row).PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End Sub


"Simon" wrote in message
...
Hi all,

I normally don't dabble in VBA / Macros as I feel out of my depth.
However
I would like to set up a "hopefully simple" macro and need your
assistance.

I have a formula in column R and column S. What I would like to do is
create a macro to:
1) Insert a row from the current position - Inserting a row will never be
at
the first or the last row; always somewhere in the middle
2) Copy (or fill down) the formulae from columns R & S in the row above.

I hope this makes sense.
PS - I have found threads that could theoretically help, except for the
fact
that I have breaks in rows between different sets of data - for example, I
have 10 rows of data, a break of a few rows, then another 10 rows of data.
The break of a few rows are blank and should hopefully remain so.

Many thanks for your help,
Simon




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
Auto fill formulae when inserting rows Riker1074 Excel Discussion (Misc queries) 9 December 30th 08 03:56 PM
Insert row with formulae without contents camlad[_2_] Excel Programming 4 December 11th 08 05:25 PM
Changing font or fill-color when using formulae Phil Excel Discussion (Misc queries) 1 April 4th 08 01:02 PM
Macro to Insert a row and copy Formulae Philip J Smith Excel Programming 3 February 2nd 06 03:29 PM
macro to insert pair of formulae in x number of rows -URGENT!!! marika1981 Excel Programming 5 June 22nd 05 04:41 PM


All times are GMT +1. The time now is 09:16 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"