Thread: VBA code help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mario mario is offline
external usenet poster
 
Posts: 26
Default VBA code help

Thanks in advance for all your help. I have two questions.

Question 1:
-------------

I want to change this:
ActiveWorkbook.Names.Add Name:="MyRangeName", RefersTo:= _
"=Sheet7!B2:" & Cells(LastRow, LastColumn).Address

to this:
ActiveWorkbook.Names.Add Name:="MyRangeName", RefersTo:= _
"<VBA code for current worksheet name"&"!B2:" & Cells(LastRow,
LastColumn).Address

I want to get the VBA code for getting the current worksheet name and
replace "sheet7" with the name of the current worksheet.

Question 2:
-------------

I want to run a vba function for all the worksheets in an excel file (or
current workbook). I am looking to create a function some thing like this:

For Every Worksheet
Function MakeChaneges 'Run the function with name "make changes"
Next

can you help me with the code for the "For" "Next" Loop

Thanks