Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA across worksheets

Status
Not open for further replies.

RicksAtWork

Programmer
Nov 1, 2005
120
GB
I have a workbook (W1) that has a bunch of methods.

The same workbook creates a new workbook (W2).

In a macro on W1 I want to execute another macro held on W1 but this must operate upon W2 ie.e

Windows("W2").Activate
W1Macro(WorkSheet(worksheetinW2))


But this doesnt work!

 


Code:
Workbooks("W2").Worksheets("Sheet1").Cells(1,1).value = "Hello"


Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
So if I want to run the macro held in workbook1 on a sheet in Workbook2 I would have guessed that this would have worked.

Workbooks(KOLWorkSheetFilename).ApplyDesign Workbooks(ExportWorkSheetFilename).Worksheets(CStr(country))

It doesnt! ApplyDesign is my macro which accepts a worksheet

Any ideas???
 


Please post your complete code

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
Have you tried somethis like this ?
Call ApplyDesign(Workbooks(ExportWorkSheetFilename).Worksheets(CStr(country)))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top