Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro If Statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Macro If Statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Macro If Statement

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
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
If statement in macro orquidea Excel Discussion (Misc queries) 2 May 11th 08 08:19 PM
Run Macro From If Statement bhalooneel Excel Programming 3 June 3rd 05 10:07 PM
IF statement in a macro iamn94 Excel Programming 1 April 17th 05 03:17 AM
IF statement macro Qwerty Excel Programming 1 January 11th 04 09:22 PM
Macro statement Sheela Excel Programming 1 September 2nd 03 10:17 AM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"