ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Query (https://www.excelbanter.com/excel-discussion-misc-queries/197037-macro-query.html)

carla 7

Macro Query
 
Newbie here, please help with the following: I have a workbook with all
worksheets formatted the same. I am in need of a macro that will copy the
value of a cell, say M6, in each M6 cell from the 80 worksheets, and then
paste it to the last sheet in the workbook. However, the cells in the last
worksheet should be pasted one cell down consecutivively.

Greatly appreciate your help

Jarek Kujawa[_2_]

Macro Query
 
try this macro

Sub kopiuj()

For Each Worksheet In ActiveWorkbook.Worksheets
i = i + 1
If i < ActiveWorkbook.Worksheets.Count Then
Worksheets(i).Range("M6").Copy
Worksheets(ActiveWorkbook.Worksheets.Count).Cells( i, 1).PasteSpecial
Paste:=xlValues
End If
Next

End Sub

pastes values from M6 in any worksheet (but the last one) to the last
one, starting from A1

adjust yr ranges as necessary

carla 7

Macro Query
 
Thanks for your reply, I am getting a compile error:syntax error message for
line:
Paste:=xlValues. But the macro seems to be the right one except for the
syntax error.
"Jarek Kujawa" wrote:

try this macro

Sub kopiuj()

For Each Worksheet In ActiveWorkbook.Worksheets
i = i + 1
If i < ActiveWorkbook.Worksheets.Count Then
Worksheets(i).Range("M6").Copy
Worksheets(ActiveWorkbook.Worksheets.Count).Cells( i, 1).PasteSpecial
Paste:=xlValues
End If
Next

End Sub

pastes values from M6 in any worksheet (but the last one) to the last
one, starting from A1

adjust yr ranges as necessary


Don Guillett

Macro Query
 
try this.

Sub copyeachshtcelltosummary()
ds = Sheets(Sheets.Count).Name
For i = 1 To Sheets.Count - 1
Sheets(i).Range("m6").Copy Sheets(ds).Cells(i, "a")
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"carla 7" wrote in message
...
Newbie here, please help with the following: I have a workbook with all
worksheets formatted the same. I am in need of a macro that will copy the
value of a cell, say M6, in each M6 cell from the 80 worksheets, and then
paste it to the last sheet in the workbook. However, the cells in the
last
worksheet should be pasted one cell down consecutivively.

Greatly appreciate your help



carla 7

Macro Query
 
Waw! you guys are amazing....

"Don Guillett" wrote:

try this.

Sub copyeachshtcelltosummary()
ds = Sheets(Sheets.Count).Name
For i = 1 To Sheets.Count - 1
Sheets(i).Range("m6").Copy Sheets(ds).Cells(i, "a")
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"carla 7" wrote in message
...
Newbie here, please help with the following: I have a workbook with all
worksheets formatted the same. I am in need of a macro that will copy the
value of a cell, say M6, in each M6 cell from the 80 worksheets, and then
paste it to the last sheet in the workbook. However, the cells in the
last
worksheet should be pasted one cell down consecutivively.

Greatly appreciate your help




carla 7

Macro Query
 

Hello Jarek,

Fast question. Instead of the macro pasting to the values to the last
worksheet vertically, is there anyway it can paste the values horizontally?

Please Help
"Jarek Kujawa" wrote:

try this macro

Sub kopiuj()

For Each Worksheet In ActiveWorkbook.Worksheets
i = i + 1
If i < ActiveWorkbook.Worksheets.Count Then
Worksheets(i).Range("M6").Copy
Worksheets(ActiveWorkbook.Worksheets.Count).Cells( i, 1).PasteSpecial
Paste:=xlValues
End If
Next

End Sub

pastes values from M6 in any worksheet (but the last one) to the last
one, starting from A1

adjust yr ranges as necessary



All times are GMT +1. The time now is 07:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com