Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to create a macro which when run in excel sheet, use
GetOpenFilename method to reads a selection of cells from another excel sheet into a selection of cells within that spreadsheet. I used the following syntax but it does seem to work (where proj blank basics is the name oif the sheet) Any ideas? filename = Application.GetOpenFilename() MsgBox filename If filename = False Then MsgBox "No file was selected" Exit Sub End If Range("B2").Select ActiveCell.FormulaR1C1 = _ "='" & filename & "]Proj Plan Basics'!R7C1" |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
Filename = Application.GetOpenFilename() MsgBox Filename If Filename = False Then MsgBox "No file was selected" Exit Sub End If ipos = InStrRev(Filename, "\") Filename = Left(Filename, ipos) & "[" & Right(Filename, Len(Filename) - ipos) & "]" Range("B2").FormulaR1C1 = _ "='" & Filename & "Proj Plan Basics'!R7C1" -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "nir020" wrote in message ... I am trying to create a macro which when run in excel sheet, use GetOpenFilename method to reads a selection of cells from another excel sheet into a selection of cells within that spreadsheet. I used the following syntax but it does seem to work (where proj blank basics is the name oif the sheet) Any ideas? filename = Application.GetOpenFilename() MsgBox filename If filename = False Then MsgBox "No file was selected" Exit Sub End If Range("B2").Select ActiveCell.FormulaR1C1 = _ "='" & filename & "]Proj Plan Basics'!R7C1" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reading txt file and copying the lines in new excel file | Excel Programming | |||
reading from another file and pasting to current file, "combobox" | New Users to Excel | |||
reading data from 2nd file in 1st file using Combobox | Excel Programming | |||
reading from text file to excel file | Excel Programming | |||
Reading a zip file | Excel Programming |