Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am new to VBA and don't have much experience in creating code, however what
I am trying to do I have seen in other people's excel sheets, but they were password protected and so I couldn't look at them. Here is what I am trying to do: I have a cell, say "A1" that requires an input. There is a set of equations in a table in the same excel spreadsheet. When the input is entered, say "5", and then a button is pressed, the 5 rows are added to the table and the equations are copied down. So I think I need an if statement based on the "A1" input. Or should this be a loop statement. Thanks in advance for any help on this. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I am reading you correctly, you said you want 5 rows added to the table.
The bottom of the table?? Lots of blank rows are already there. I assumed your table was from Column D to Column G. This macro will copy the formulas from the last row of the table to a number of rows down equal to the number in A1. Make this message full screen to avoid line wrapping. HTH Otto Sub Macro1() Range("D" & Rows.Count).End(xlUp).Resize(, 4).Copy Range("D" & Rows.Count).End(xlUp).Offset(1).Resize(Range("A1") .Value).PasteSpecial End Sub "Mark64" wrote in message ... I am new to VBA and don't have much experience in creating code, however what I am trying to do I have seen in other people's excel sheets, but they were password protected and so I couldn't look at them. Here is what I am trying to do: I have a cell, say "A1" that requires an input. There is a set of equations in a table in the same excel spreadsheet. When the input is entered, say "5", and then a button is pressed, the 5 rows are added to the table and the equations are copied down. So I think I need an if statement based on the "A1" input. Or should this be a loop statement. Thanks in advance for any help on this. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Line wrapping messed it up anyway. The macro consists of 4 lines. The
second line ends with "Copy". The third line ends with "PasteSpecial". HTH Otto "Otto Moehrbach" wrote in message ... If I am reading you correctly, you said you want 5 rows added to the table. The bottom of the table?? Lots of blank rows are already there. I assumed your table was from Column D to Column G. This macro will copy the formulas from the last row of the table to a number of rows down equal to the number in A1. Make this message full screen to avoid line wrapping. HTH Otto Sub Macro1() Range("D" & Rows.Count).End(xlUp).Resize(, 4).Copy Range("D" & Rows.Count).End(xlUp).Offset(1).Resize(Range("A1") .Value).PasteSpecial End Sub "Mark64" wrote in message ... I am new to VBA and don't have much experience in creating code, however what I am trying to do I have seen in other people's excel sheets, but they were password protected and so I couldn't look at them. Here is what I am trying to do: I have a cell, say "A1" that requires an input. There is a set of equations in a table in the same excel spreadsheet. When the input is entered, say "5", and then a button is pressed, the 5 rows are added to the table and the equations are copied down. So I think I need an if statement based on the "A1" input. Or should this be a loop statement. Thanks in advance for any help on this. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If statement in macro | Excel Discussion (Misc queries) | |||
Run Macro From If Statement | Excel Programming | |||
IF statement in a macro | Excel Programming | |||
IF statement macro | Excel Programming | |||
Macro statement | Excel Programming |