Copy single cell value from multiple worksheets

MSPECS77

New Member
Joined
Oct 12, 2010
Messages
3
I'm not sure if there is a thread relating to this but the ones I have come across did not help, but I'm sure that's to do with my lack of knowledge on VBA!!
I want help on creating a macro that will copy one cell value from a set of worksheets to a summary worksheet. I'm using MS Excel 2003.
The cell value in each worksheet = O8
The worksheets range from '200501' to '201009' or indexed from 25 to 93
The summary worksheet is called 'RAW DATA'
I need the data to paste into cell C3 downwards! and also need it to recognize if the cell above is empty.
Alternative: If there us a formula that can do the above and I can use the autofill function then please let me know of one.
Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I'm not sure if there is a thread relating to this but the ones I have come across did not help, but I'm sure that's to do with my lack of knowledge on VBA!!
I want help on creating a macro that will copy one cell value from a set of worksheets to a summary worksheet. I'm using MS Excel 2003.
The cell value in each worksheet = O8
The worksheets range from '200501' to '201009' or indexed from 25 to 93
The summary worksheet is called 'RAW DATA'
I need the data to paste into cell C3 downwards! and also need it to recognize if the cell above is empty.
Alternative: If there us a formula that can do the above and I can use the autofill function then please let me know of one.
Thanks

Untested, this might help or at least get you started.

Code:
Sub MSPECS77()



   Dim X As Integer
   
   For X = 200501 To 201009

    Sheets(X).Range("O8").Copy Sheets("RAW DATA").Cells(Rows.Count, "C").End(xlUp)(2)
      

   Next X


End Sub
 
Upvote 0
Hi John, thnx for the reply and yes I did make a start on it. I had to change the For X = 200501 TO 201009 to For X = 25 TO 93 as it did not recognize the 200501 as an integer. Then I get stuck because I need it to do a paste special for values as it was carrying over the formula of the cells. How would you include that in the statement?
 
Upvote 0
Hi John, thnx for the reply and yes I did make a start on it. I had to change the For X = 200501 TO 201009 to For X = 25 TO 93 as it did not recognize the 200501 as an integer. Then I get stuck because I need it to do a paste special for values as it was carrying over the formula of the cells. How would you include that in the statement?


I think like this:

Replace this:

Sheets(X).Range("O8").Copy Sheets("RAW DATA").Cells(Rows.Count, "C").End(xlUp)(2)

With this:

Sheets(“RAW DATA”).Cells(Rows.count, “C”).End(xlUp)(2).Value = Sheets(X).Range(“08”).Value
 
Last edited:
Upvote 0
Hi John,

I'm afraid I get a 1004 run-time error. Any other ideas?

Sorry, there was a typo in my last suggestion Range("08"), should be Range("O8"). Make that correction and try it then. If that doesn't work then maybe the line below.

Maybe:

Sheets(“RAW DATA”).Cells(Rows.count, “C”).End(xlUp)(2).Resize(Sheets(X).Range("O8").Cells.Count).Value = Sheets(X).Range(“O8”).Value
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top