Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mac mac is offline
external usenet poster
 
Posts: 4
Default Declaring Public Procedure

The following code creates a file name. How do I change
this as a public statement in order to use wherever i want
to use the file name in the same workbook? I tried
something like public Myfilename , but it doesn't works?
Any help highly appreciated?


FlName = Format(Sheets("summary").Range("rptdate") -
1, "mmm dd")
Mydir = "C:\Daily Reports\"
If WeekDay(Sheets("summary").Range("rptdate")) =
vbMonday Then
myfile = Format(Sheets("summary").Range("rptdate") -
3 - Range("holid"), mmm dd")
Else
myfile = Format(Sheets("summary").Range("rptdate") -
Range("holid") - 1, "mmm dd")
End If
FileName = Mydir & "[" & myfile & "]"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Declaring Public Procedure

Public FileName as String

What's the issue -- why do you say this doesn't work?


"mac" wrote in message
...
The following code creates a file name. How do I change
this as a public statement in order to use wherever i want
to use the file name in the same workbook? I tried
something like public Myfilename , but it doesn't works?
Any help highly appreciated?


FlName = Format(Sheets("summary").Range("rptdate") -
1, "mmm dd")
Mydir = "C:\Daily Reports\"
If WeekDay(Sheets("summary").Range("rptdate")) =
vbMonday Then
myfile = Format(Sheets("summary").Range("rptdate") -
3 - Range("holid"), mmm dd")
Else
myfile = Format(Sheets("summary").Range("rptdate") -
Range("holid") - 1, "mmm dd")
End If
FileName = Mydir & "[" & myfile & "]"



  #3   Report Post  
Posted to microsoft.public.excel.programming
mac mac is offline
external usenet poster
 
Posts: 4
Default Declaring Public Procedure

The issue is when I call this in another sub it doesn't
goes to that: This what I am doing

sub DataUpdate()
Sheets("Sheet2").Select
ActiveSheet.Range("AD5").Select
ActiveCell.Formula = ActiveCell.Formula = "=VLOOKUP
(I4,'" & filename & "Sheet2'!Sectdata,14,FALSE)"
end sub

Here it doesn't takes my file name?


-----Original Message-----
Public FileName as String

What's the issue -- why do you say this doesn't work?


"mac" wrote in

message
...
The following code creates a file name. How do I change
this as a public statement in order to use wherever i

want
to use the file name in the same workbook? I tried
something like public Myfilename , but it doesn't works?
Any help highly appreciated?


FlName = Format(Sheets("summary").Range("rptdate") -
1, "mmm dd")
Mydir = "C:\Daily Reports\"
If WeekDay(Sheets("summary").Range("rptdate")) =
vbMonday Then
myfile = Format(Sheets("summary").Range

("rptdate") -
3 - Range("holid"), mmm dd")
Else
myfile = Format(Sheets("summary").Range

("rptdate") -
Range("holid") - 1, "mmm dd")
End If
FileName = Mydir & "[" & myfile & "]"



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Declaring Public Procedure

Try

FileName = Mydir & "[" & myfile & ".xls" & "]"

--
Regards,
Tom Ogilvy

"mac" wrote in message
...
The issue is when I call this in another sub it doesn't
goes to that: This what I am doing

sub DataUpdate()
Sheets("Sheet2").Select
ActiveSheet.Range("AD5").Select
ActiveCell.Formula = ActiveCell.Formula = "=VLOOKUP
(I4,'" & filename & "Sheet2'!Sectdata,14,FALSE)"
end sub

Here it doesn't takes my file name?


-----Original Message-----
Public FileName as String

What's the issue -- why do you say this doesn't work?


"mac" wrote in

message
...
The following code creates a file name. How do I change
this as a public statement in order to use wherever i

want
to use the file name in the same workbook? I tried
something like public Myfilename , but it doesn't works?
Any help highly appreciated?


FlName = Format(Sheets("summary").Range("rptdate") -
1, "mmm dd")
Mydir = "C:\Daily Reports\"
If WeekDay(Sheets("summary").Range("rptdate")) =
vbMonday Then
myfile = Format(Sheets("summary").Range

("rptdate") -
3 - Range("holid"), mmm dd")
Else
myfile = Format(Sheets("summary").Range

("rptdate") -
Range("holid") - 1, "mmm dd")
End If
FileName = Mydir & "[" & myfile & "]"



.



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
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 08:27 PM
Declaring variables freekrill Excel Discussion (Misc queries) 0 July 18th 06 06:15 PM
DEclaring variables Pedro Excel Programming 2 November 13th 03 11:54 AM


All times are GMT +1. The time now is 10:56 AM.

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

About Us

"It's about Microsoft Excel"