Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default working on a selected file via GetOpenFilename


Hello, I want to modify the code below to:

1. Allow the user to browse for a file and select a file

2. Perform all the steps in a second function on the selected file i
#1.

Naturally step one has to be completed first after which th
GetDataFromClosedWorkbook() should run.


AT the moment they are both running the same time. I am a newbie at i
Excel VBA so please pardon me if this is really simple :)

Cheers!


Sub test()
Dim F As Variant
F = Application.GetOpenFilename("csv Files (*.csv), *.csv")
If F = False Then Exit Sub
Workbooks.Open F
End Sub

Sub GetDataFromClosedWorkbook()

Dim wb As Workbook
Application.ScreenUpdating = True ' turn off the screen updating
Set wb = Workbooks.Open("C:\Documents and Settings\user\Desktop\Q
Checklists.xls", True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("Sheet1")
' read data from the source workbook
.Range("A10").Formula
wb.Worksheets("PM").Range("A10").Formula
' .Range("A11").Formula
wb.Worksheets("SourceSheetName").Range("A20").Form ula

End With
wb.Close False ' close the source workbook without saving an
changes
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating
End Su

--
periro1
-----------------------------------------------------------------------
periro16's Profile: http://www.excelforum.com/member.php...fo&userid=2634
View this thread: http://www.excelforum.com/showthread.php?threadid=46949

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
print selected columns not working SLP Excel Discussion (Misc queries) 2 January 13th 09 02:22 PM
Using FileDialog or GetOpenFileName To Allow File Creation WhyIsDoug Excel Programming 1 July 28th 05 05:14 PM
Select file after GetOpenFilename RB Smissaert Excel Programming 1 February 5th 05 04:15 PM
Working with a cell in a selected row kls[_2_] Excel Programming 2 September 12th 04 10:14 AM
Working with a selected range OkieViking Excel Programming 3 June 10th 04 07:21 PM


All times are GMT +1. The time now is 11:19 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"