Hello,
I've already created a dropdown so an end user can pull up a specific file, and this will create a link to a variety of files (.xls, .txt., .pdf, ect...).
I'd like to set about twenty files within the given folder to transfer to a specific sheet within the same workbook.
I.e. - One file is "Gross to Net.xls", and once the user selects the dropdown the "Gross to Net.xls" information will be automatically copied and pasted to a sheet (labeled "GTN"). This should happen for all twenty files which will have the same sheet name, so next time the user drops down on another file, different information is populated in each of the 20 sheets.
So far I can pull up the folder for the user to select the file, but I would like VBA to copy/paste for them:
[CODE=VB]
Sub GrossToNet()
ActiveSheet.Sha pes("AutoShape 109").Select
Selection.Chara cters.Text = "GrossToNetSumm ary. xls"
Dim fn As Variant
ChDrive "T:\"
ChDir ([GTN])
fn = Application.Get OpenFilename("A ll files,*.*,XLS Files,*.xls,", _
1, "Technician Technical Information - Select folder and file to open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Select Case Right(fn, 3)
Case Is = "xls"
ActiveWorkbook. FollowHyperlink Address:=fn
Case Else
MsgBox "Please select an Excel file."
End Select
Range("a1").Sel ect
End Sub[/CODE]
I've already created a dropdown so an end user can pull up a specific file, and this will create a link to a variety of files (.xls, .txt., .pdf, ect...).
I'd like to set about twenty files within the given folder to transfer to a specific sheet within the same workbook.
I.e. - One file is "Gross to Net.xls", and once the user selects the dropdown the "Gross to Net.xls" information will be automatically copied and pasted to a sheet (labeled "GTN"). This should happen for all twenty files which will have the same sheet name, so next time the user drops down on another file, different information is populated in each of the 20 sheets.
So far I can pull up the folder for the user to select the file, but I would like VBA to copy/paste for them:
[CODE=VB]
Sub GrossToNet()
ActiveSheet.Sha pes("AutoShape 109").Select
Selection.Chara cters.Text = "GrossToNetSumm ary. xls"
Dim fn As Variant
ChDrive "T:\"
ChDir ([GTN])
fn = Application.Get OpenFilename("A ll files,*.*,XLS Files,*.xls,", _
1, "Technician Technical Information - Select folder and file to open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Select Case Right(fn, 3)
Case Is = "xls"
ActiveWorkbook. FollowHyperlink Address:=fn
Case Else
MsgBox "Please select an Excel file."
End Select
Range("a1").Sel ect
End Sub[/CODE]
Comment