Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default open, copy, and paste


I am almost done with a fairly large macro. I have it setup to d
everything I want with the data I pull in. One problem, I don't kno
how to pull it in. I have a browse button that uses th
getfilenameopen command and it dumps a path in a cell.

Let's say the path is in cell A1 on sheet1. I want sheet2 to look jus
like the file that's path is in sheet1!A1.

Also, for the getfilenameopen, how can I make it default to alread
have a particular drive selected. I have several, and I want P: to b
the first drive I see instead of going through my computer....

Any help would be appreciated

--
jackson
-----------------------------------------------------------------------
jacksonz's Profile: http://www.excelforum.com/member.php...fo&userid=1372
View this thread: http://www.excelforum.com/showthread.php?threadid=38904

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default open, copy, and paste

hi,
here is some code i use. not sure if it will help you but maybe it will give
you ideas

Dim mybook As Workbook 'an excel workbook- used at line 34
Dim FNames As String 'workbook(or file) name - used at lines 20,
21, 33
Dim MyPath As String 'file path - use at lines 15,16,18,19,35
Dim SaveDriveDir As String 'current directory - used at lines
14,23,24,73,74
Dim cnt As Long 'counter to count Workbooks - used at lines
29,69,72
Dim cnt2 As Long
Dim cnt3 As Long
Dim c As String 'string to find in workbook - used at lines
31,32,36
Dim rng As Range 'range to search - used at lines
36,43,44,45,49,56,57,61,62,65
Dim Infocell As Range 'cell offset from rng. wanted info of rng
Dim sAddr As String 'range address of first find - used at lines
44,51,57,66

SaveDriveDir = CurDir 'Mark current directory
prior to search
'MyPath = InputBox("Enter a File Path") 'Get file path from inputbox
MyPath = "h:\excel\MRPLocQtyByDate\" 'Or state file path in code
'MyPath = Range("B3").Value 'Or get file path from cell
address
Range("B3").Value = MyPath 'display path in file(cell)
ChDrive MyPath 'change to path drive
ChDir MyPath 'change to path directory
FNames = Dir("*.xls") 'state type of file to search
If Len(FNames) = 0 Then 'if not xls then abort
MsgBox "No files in the Directory" 'message to user
ChDrive SaveDriveDir 'go back to previous drive
ChDir SaveDriveDir 'to back to previous directory
Exit Sub 'exit the code
End If


"jacksonz" wrote:


I am almost done with a fairly large macro. I have it setup to do
everything I want with the data I pull in. One problem, I don't know
how to pull it in. I have a browse button that uses the
getfilenameopen command and it dumps a path in a cell.

Let's say the path is in cell A1 on sheet1. I want sheet2 to look just
like the file that's path is in sheet1!A1.

Also, for the getfilenameopen, how can I make it default to already
have a particular drive selected. I have several, and I want P: to be
the first drive I see instead of going through my computer....

Any help would be appreciated.


--
jacksonz
------------------------------------------------------------------------
jacksonz's Profile: http://www.excelforum.com/member.php...o&userid=13728
View this thread: http://www.excelforum.com/showthread...hreadid=389040


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
Open WB, copy each sh. & paste into other WB, regardless of tab na Driftwood Excel Discussion (Misc queries) 0 January 29th 10 02:06 PM
copy paste to first first open row JSnow Excel Worksheet Functions 2 March 6th 09 02:35 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM


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