View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Yossi evenzur[_2_] Yossi evenzur[_2_] is offline
external usenet poster
 
Posts: 21
Default ask user to select a target sheet as an input for a macro

Hi Rick
Please take a look at the following:
1)
Answer = InputBox("Tell me a sheet name")

'the Answer is"XXXX"

ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R[1]C,'"What do I put HERE ???"'!R2C1:R255C3,3,FALSE)"

2) why can't i simply (simply?) click on the sheet?

"Rick Rothstein (MVP - VB)" wrote:

Another possibility... Execute this statement in your macro at the point you
want to get the sheet name...

Answer = InputBox("Tell me a sheet name")

and then reference that sheet in your code using this Worksheets(Answer). As
an example...

Worksheets(Answer).Range("D4").Value = "Hello"

You will probably need to put some error checking code in just in case your
user types the sheet name in wrong though.

Rick


"Yossi evenzur" wrote in message
...
How or what is the vba syntax if i want the user to select a atrget
sheet for a macro as an input?