Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA

Status
Not open for further replies.

wwexcel

Technical User
Jun 10, 2009
1
US
Hello All,
Looking to do soemthing simple...

Have a list of numbers 1-100 in worksheet A. I want to take the #1, put it in a new worksheet (B), in cell A1. Once the number is there, it will trigger calculations in that row. I want to then copy the row and past it to worksheet C. Repeat with the number 2 in worksheet A, etc until I have gone through the number 100 in worksheet A and have 100 rows in worksheet C.

Any one have this basic code ? Would greatly appreciate.
 
It doesn't sound like you need VBA here.

Can you not just:
a) copy the numbers from worksheet A and paste them in A1:A100 on worksheet C
b) copy the formulae on worksheet B to B1 on worksheet C...
c) ...then copy those formulae down to B100?

If you are after VBA code to do something else or you simply want to generate example code, have you considered using the Macro Recorder? This will give you the bulk of the code you require, which you will then need to incorporate into a FOR loop. i.e

Code:
FOR X=1 to 100
   ' amended recorded macro
NEXT X

Fen
 
If you DO end up wanting to go with the VBA approach for this or anything else, and need help, it'd be best to post over in
forum707.

--

"If to err is human, then I must be some kind of human!" -Me
 
Fenrirshowl's idea is a good one ( copy the numbers and formulae into worksheet C) ... is there any reason why you couldn't do that?

I sometimes ( very rarely ) have a set of calculations that are so complex that I don't want to duplicate them through the workbook, in which case I create a Data Table. A One-Variable Data Table would do what you want ... having your 100 numbers as the Column Input numbers, and formulae referencing results in worksheet B as the source formulae for the Data Table.





Cheers, Glenn.

Beauty is in the eye of the beerholder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top