Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can someone tell me how to define a variable to hold the name of the current
file so that later I can reactivate the file by referring to the variable rather hard code its name? Thanks - It escapes me ! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mervyn,
Try something like Dim FName As String FName = ActiveWorkbook.Name ' more code here Workbooks(FName).Activate -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Mervyn Thomas" wrote in message ... Can someone tell me how to define a variable to hold the name of the current file so that later I can reactivate the file by referring to the variable rather hard code its name? Thanks - It escapes me ! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim myWkbk as workbook
set mywkbk = activeworkbook '''do lots of stuff mywkbk.activate But lots of times you don't even have to activate it to work with it. mywkbk.worksheets("sheet1").range("B37").value = "Hi there" would assign a text value to B37 in sheet1 of that workbook. Mervyn Thomas wrote: Can someone tell me how to define a variable to hold the name of the current file so that later I can reactivate the file by referring to the variable rather hard code its name? Thanks - It escapes me ! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Define variable range input for SUM() function | Excel Worksheet Functions | |||
Define Variable Name using VBA | Excel Discussion (Misc queries) | |||
Using a Variable to Define Series | Charts and Charting in Excel | |||
How to take the worksheet name as a variable(Label/Define) in a fo | Excel Worksheet Functions | |||
Macro syntax to open file in current explorer folder | Excel Discussion (Misc queries) |