Copying one Column to ALL worksheets

Abgar

Active Member
Joined
Jun 20, 2009
Messages
265
Hey guys,
Is it possible to select one column from a defined sheet name (Sheet.Name "Invoice" - Column V) and copy to ALL worksheets in the book and place in column V?

The catch is that each worksheet has a different name, and there are a variable number of worksheets...

I'm currently using the below for a similar sort of thing. Can this be adapted?
Code:
For Each wks In Worksheets
        wks.Activate
[COLOR=Red]       OTHER CODING (irrelevant for this purpose)
[COLOR=Black]Next wks
Call WriteDataToText[/COLOR]
[/COLOR]


Is this possible and / or easy?

Cheers guys :)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
This should get you started!1
Code:
Sub CopyV()
Dim ws As Worksheet
Sheet1.Range("V:V").Copy
For Each ws In Sheets
If ws.Name <> "Sheet1" Then
  ws.Range("V1").PasteSpecial
End If
Next ws
Application.CutCopyMode = False
End Sub
lenze
 
Upvote 0
Thanks Lenze,

It's working really well :)

Just wondering if you could help me input something into that specific piece of coding
Code:
Sub Ranges()
    Dim ws As Worksheet
Range("W:W").Copy
For Each ws In Sheets
If ws.Name <> "Sheet2" Then
  ws.Range("AB1").PasteSpecial
  [COLOR=Red]CR = Cells(Rows.Count, "AB").End(xlUp).Row
Range("AA2:AA" & CR).Formula = "=IF(AND(LEFT(RC[1],1)=""0"",MID(RC[1],5,1)&MID(RC[1],9,1)=""  "",LEN(RC[1])=12,ISNUMBER(SUBSTITUTE(RC[1],"" "","""")+0)),SUBSTITUTE(REPLACE(RC[1],1,1,61),"" "",""""),RC[1])"[/COLOR]
  End If
 Next ws
Application.CutCopyMode = False
End Sub
I need to add the Red bit into there, but when i do, it just ignores it.
Macro doesn't error or anything like that, it just doesnt DO it.
Would you have any ideas on what else i need to input to make it work?

Thanks so much again :)
 
Upvote 0
Try this
Rich (BB code):
CR = ws.Cells(Rows.Count, "AB").End(xlUp).Row
ws.Range("AA2:AA" & CR).Formula = "=IF(AND(LEFT(RC[1],1)=""0"",MID(RC[1],5,1)&MID(RC[1],9,1)=""  "",LEN(RC[1])=12,ISNUMBER(SUBSTITUTE(RC[1],"" "","""")+0)),SUBSTITUTE(REPLACE(RC[1],1,1,61),"" "",""""),RC[1])"
Unless you tell the code which worksheet to look at, it assumes the sheet that was active when the macro was started.

lenze
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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