ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   extend vba code to other sheets (https://www.excelbanter.com/excel-programming/354879-extend-vba-code-other-sheets.html)

evil baby[_7_]

extend vba code to other sheets
 

I wrote vba code for the main sheet of my workbook but I would like th
other 11 sheets to follow the same code. Is there an easy way to d
this

--
evil bab
-----------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...fo&userid=3198
View this thread: http://www.excelforum.com/showthread.php?threadid=51826


evil baby[_8_]

extend vba code to other sheets
 

Ok, I figured out how to get it to go to other worksheets but now I'
getting an error.

All the error says is "400" and nothing else. When I select hel
nothing shows up. anybody know what this means

--
evil bab
-----------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...fo&userid=3198
View this thread: http://www.excelforum.com/showthread.php?threadid=51826


Tom Ogilvy

extend vba code to other sheets
 
Close excel and restart. That may clear it up.

--
Regards,
Tom Ogilvy

"evil baby" wrote
in message ...

Ok, I figured out how to get it to go to other worksheets but now I'm
getting an error.

All the error says is "400" and nothing else. When I select help
nothing shows up. anybody know what this means?


--
evil baby
------------------------------------------------------------------------
evil baby's Profile:

http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=518265




evil baby[_9_]

extend vba code to other sheets
 

ok, I changed my code so that instead of running from one sheet and
copied and pasted the code from the first sheet to the remaining sheets
and it works no problem.


Any idea why it would give me an error if "400" if I do something like


Here is the code that I'm using

http://www.rafb.net/paste/results/9oimc149.html

The error happens on line 6 when it gets to sheet # 2


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=518265


[email protected]

extend vba code to other sheets
 
400 error may have to do with attempting to assign to a protected cell.

For the 11 sheets - yeah - put the shared code an XLA Addin.


evil baby[_10_]

extend vba code to other sheets
 

ok, I just tried to copy and paste the code to each individual
worksheet. I got the same error until I changed the macro name from
change_colour to change_colour2

Does this always happen?


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=518265


evil baby[_11_]

extend vba code to other sheets
 

ok just add.

I have originally. Worksheets("OVERALL DS SUMMARY").Activate
{
'first line is Range("G6").select
all of my conditional formating code

}

' then I add

Worksheets("DS Admin - RC3000").Activate
MsgBox "hello"
Range("G6").select
MsgBox "hello2"




It gets to the first msgbox but then it crashes with the error "400".

DS Admin and DS SUMMARY are identicle in layout but have different
values


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=518265


evil baby[_12_]

extend vba code to other sheets
 

Turns out it was just one big newb mistake. I had my code in sheet14
(OVERALL DS SUMMARY) instead of "This Workbook"

thanks for trying to help though


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=518265



All times are GMT +1. The time now is 09:01 AM.

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