Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I create a Define in Excel VBA ?

Posted on 2014-11-12
2
Medium Priority
?
98 Views
Last Modified: 2014-11-12
Hi All,

I am opening a file in my VBA procedure and assigning the filename to a string variable - sFileName.

How do I create a Define in VBA which will allow me to enter the Define as a cell eg =sFileName

Thanks
0
Comment
Question by:Tocogroup
2 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 2000 total points
ID: 40437136
What do you mean by a 'Define'?

If you wanted to put the filename in a cell on a worksheet you could use this.
Sheets("Sheet1").Range("B2").Value = sFileName

Open in new window

0
 

Author Closing Comment

by:Tocogroup
ID: 40437143
Yes, you're right. I think I overcomplicated the solution. Once I've got the filename then I can display it in whatever cell I want.
Thanks for the clarity.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question