Copying one Column to ALL worksheets

Abgar

Active Member
Joined
Jun 20, 2009
Messages
255
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 :)
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
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
 

Abgar

Active Member
Joined
Jun 20, 2009
Messages
255

ADVERTISEMENT

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 :)
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,651
Members
414,083
Latest member
Mrsash

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
Top