Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Post File Size In Cell

Hello. I am fairly new to using VBA with Excel.

I have a Data Validation list of a filenames with a directory.
Once I make a filename selection from the list, I'd like the
file's size to be placed into a specific cell.

For example, if I chose from the Data Validaton List
"C:\Temp\Parts.xls", I'd like it's equivalent file size to be
placed into cell B1 on Sheet1.

What VBA code would accomplish this?

Thank you for your help.

Wayne

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Post File Size In Cell

assume the dropdown is in B9 and the results go to C9

right click on the sheet tab and select view code. Put in code like this

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sPath as String
On Error Resume next
spath = "C:\Myfolder\"
if Target.Address = "$B$9" then
if Target.Value < "" then
s = sPath & target.Value
if dir(s) < "" then
target.offset(0,1).Value = filelen(s)
end if
end if
end if
End Sub

--
Regards,
Tom Ogilvy


"WayneK" wrote:

Hello. I am fairly new to using VBA with Excel.

I have a Data Validation list of a filenames with a directory.
Once I make a filename selection from the list, I'd like the
file's size to be placed into a specific cell.

For example, if I chose from the Data Validaton List
"C:\Temp\Parts.xls", I'd like it's equivalent file size to be
placed into cell B1 on Sheet1.

What VBA code would accomplish this?

Thank you for your help.

Wayne


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Post File Size In Cell

Thank you, Tom, for your helpful input.

Wayne

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
Excel 2003 Cell Comments causes large file size? ICE Excel Discussion (Misc queries) 4 January 31st 07 07:36 PM
How do I get a post card size invoice that calculates Sheila Setting up and Configuration of Excel 1 August 22nd 06 11:21 PM
How do I make the verticle scroll bar full size post row delete? jaws2act Excel Discussion (Misc queries) 1 February 15th 06 09:35 PM
File size (2nd post) Bobby Atkinson[_2_] Excel Programming 3 November 25th 04 01:39 AM
VBA - on a button event, open another closed file, post changes, close file Fio Excel Programming 0 March 1st 04 01:08 PM


All times are GMT +1. The time now is 11:45 PM.

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"