View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default Macro to run on the "Active Sheet"

Hi David...........
Maybe this is what you are looking for.........with the "Pertinent Sheet"
name in cell A1, this macro will take you to it, assuming it exists, and then
run your "PasteFromFinal" macro.....

Sub SwitchSheetToCellValue()
Dim PertinentSheet
PertinentSheet = Range("a1").Value
Worksheets(PertinentSheet).Select
Call PasteFromFinal
End Sub


hth
Vaya con Dios,
Chuck, CABGx3



"David P." wrote:

Thank you for your patience. What I think I need to add into my code is a way
to temporarily mark the pertinent worksheet the "active worksheet" so that
the correct sheet is activated in order for the "Call PasteFromFinal" will
work. I believe this isn't working because I need to tell it what sheet I
want the macro to run on but the thing is the file name for that worksheet
will vary (each file is save under our customer's last name, first name). Any
suggestions?
--
David P.


"CLR" wrote:

Sorry David...........

Just replace your line that reads........
Application.Run "'New Customer.xls'!PasteFromFinal"

with this line........

Call PasteFromFinal

and yes, there is a space between Call and PasteFromfinal

You need only one entry of "Call PasteFromFinal" to run the
"PasteFromFinal" macro, but you can do it as many times as you wish, like if
you want to do other stuff in between times.......

hth
Vaya con Dios,
Chuck, CABGx3


"David P." wrote:

Si, voy con Dios!

Thank you Chuck. Revealing my novice level with Excel & Visual Basic,

1) Where in the code do I put "Call PasteFinal"?
2) Do I put a space between "Call" & "PasteFinal"?
3) Do I put "Call Paste Final" in more than 1 part of the code?

--
David P.


"CLR" wrote:

Try this line instead...........

Call PasteFromFinal


hth
Vaya con Dios,
Chuck, CABGx3



"David P." wrote:

I am attempting to trigger a macro within a macro. The code I am using limits
me to the current file name as opposed to the "Active Sheet". The current
file name in this case is "New Customer" but in the way that I want to use
this macro it could be any file name, i.e. "Doe, John". In light of my
elementary code below what can I change to allow this macro to trigger for
the "Active Sheet" so that the file can be any name. Here is how the code
reads now. Thanks:

Sub RunPasteFinal()
'
' RunPasteFinal Macro
' Macro recorded 4/10/2006 by _
'

'
Application.Run "'New Customer.xls'!PasteFromFinal"
End Sub

--
David P.