Run one code but mimic it on another two sheets

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,699
Office Version
  1. 2007
Platform
  1. Windows
Evening,

I have 3 worksheets which are all identical.

Currently as i type in certain cells on sheet1 the values are automatically updated in certain cells of the same sheet.

What i would like to do is be able to enter the values in cells on sheet1 but also on the other to sheets copy me as i go.
Example on sheet1

I enter the values like so A1=22 B2= 44 C4 = 66 the cells are update so Cells Z1 = A Z2 = B Z3 = C

If i then go to sheet 2 & 3 i expect to also see the same.
A1=22 B2= 44 C4 = 66 Z1 = A Z2 = B Z3 = C
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I think this is the way forward with this one.
Could you advise a code please for a command button that will do the following once pressed.

Copy value then paste value.
H6 to U4
I6 to V4
J6 to W4
K6 to X4
L6 to Y4
M6 to Z4

Then copy range A1:Z30 on Sheet1
Paste this range to Sheet2 and also Sheet3
Save all sheets.

Many thanks.
 
Upvote 0
Well i had to start somewhere so i recorded a macro.
I know the result would be long & it would need to be simplified but it fails at the first paste option.
I am at present copying from Sheet1 & Pasting to DR SITE

Code:
Private Sub CommandButton1_Click()    Range("E6").Select
    Selection.Copy
    Sheets("DR SITE").Select
    Range("E6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("F6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("F6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("G6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("G6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("H6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("H6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("I6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("I6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("J6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("J6").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("E7").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DR SITE").Select
    Range("E7").Select
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Range("O7").Select
End Sub
 
Upvote 0
I thought you had code that was executing when you typed in certain cells?

That's the code I was interested in seeing.
 
Upvote 0
The below works for me but can it be made cleaner or is it ok,or do you see an issue.

Thanks


Code:
Private Sub CommandButton1_Click()Sheets("Sheet1").Range("P6:U6").Copy Sheets("Sheet1").Range("E6")
Sheets("Sheet1").Range("E6:J6").Copy Sheets("DR SITE").Range("E6")
Sheets("Sheet1").Range("E7").Copy Sheets("DR SITE").Range("E7")
Sheets("Sheet1").Range("E6:J6").Copy Sheets("SOLD ON EBAY").Range("E6")
Sheets("Sheet1").Range("E7").Copy Sheets("DR SITE").Range("E7")
End Sub
 
Upvote 0
Hi,
I see a few issues with this code in use.

When i copy the cell value of E7 from Sheet1 to DR SITE it pastes fine but i then need to have no outside border & also make text white "so its invisible"
This is supposed to also happen for sheet SOLD ON EBAY but nothing is pasted at all in cell E7 from Sheet1




Code:
Private Sub CommandButton1_Click()Sheets("Sheet1").Range("P6:U6").Copy Sheets("Sheet1").Range("E6")
Sheets("Sheet1").Range("P7").Copy Sheets("Sheet1").Range("E7")
Sheets("Sheet1").Range("E6:J6").Copy Sheets("DR SITE").Range("E6")
Sheets("Sheet1").Range("E7").Copy Sheets("DR SITE").Range("E7")
Sheets("Sheet1").Range("E6:J6").Copy Sheets("SOLD ON EBAY").Range("E6")
Sheets("Sheet1").Range("E7").Copy Sheets("DR SITE").Range("E7")
End Sub
 
Last edited:
Upvote 0
There was a gap in the name so now pasting to SOLD ON EBAY WORKS FINE.

Just one more thing and i am finished,this is the border issue.

I recorded a simple macro but the results are a mile long.

What i require please is as follows,
Sheet DR SITE
Cell E7 remove outside borders.
Cell £7 font color white.
Cell E6 apply outside borders.


Thanks very much
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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