Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Declaring a tab name as a variable

You also need to remove the quotation marks from your variable when it is
used as a sheet name.

i.e. Sheets(TabNAME).Range("B5:B102").FormulaR1C1
--
JNW


"Jim Cone" wrote:

"Set" is used for objects only.
Change Set TabName = ActiveSheet.Name
-to-
TabName = ActiveSheet.Name
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"timmulla"
wrote in message
Can anyone help me adjust the following code to work properly. I'm getting
errors with the TabName variable. I'm trying to set the variable to the tab
name of the file that will be opened.

Sub FormatFiles()
Dim TabNAME As String
Dim WB As Workbook
Do
Set WB = Workbooks.Open(Filename:=ActiveCell)
Set TabName = ActiveSheet.Name

My Macro code - (This will be my own simple code to format the WB
workbook that was just opened)

Workbooks("Master file").Activate
Sheets("TabNAME").Range("B5:B102").FormulaR1C1 .... (This formula is a
vlookup formula the WB file.)

WB.Close True 'Save Changes
ActiveCell.Offset(1).Select
Loop Until ActiveCell = ""
End Sub


Any help would be appreciated
--
Regards,
timmulla

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring a tab name as a variable timmulla Excel Programming 0 January 25th 07 03:26 AM
Help declaring array limit with variable? Ed Excel Programming 2 October 17th 05 05:35 PM
declaring public variable value Damon Excel Programming 4 July 24th 05 02:59 PM
Declaring Variable as VBConstant The Vision Thing Excel Programming 2 May 15th 04 06:35 PM
Declaring a variable? pgoodale[_4_] Excel Programming 2 January 2nd 04 03:26 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"