kansfan2001
New Member
- Joined
- Aug 22, 2020
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
Sub vbaimport()
' Defines variables
Dim wb1 As Workbook, wb2 As Workbook
' Disable screen updating to reduce screen flicker
Application.ScreenUpdating = False
' Define which workbook is which
Set wb1 = ThisWorkbook
ChDir "C:\"
FName = Application.GetOpenFilename
If FName <> False Then
Set wb2 = Workbooks.Open(FName)
End If
' Import range A1:A5 from Sheet1 of wb2
wb1.Sheets("VBAImport").Range("A1:A5").Value2 = wb2.Sheets("Sheet1").Range("A1:A5").Value2
' Close wb2
wb2.Close
' Re-enable screen updating
Application.ScreenUpdating = True
End Sub
Hi,
I hope someone will answer this... I am looking to have wb1 dump the copied information at the bottom of a list but am having some issues getting that done.
I have tried to include an offset but it did not work. All I am looking to do is have this select column b and add what's copied to the next cell that is open. My header starts on B5 which is my constant and everything would be pasted below that point.
wb1.Sheets("VBAImport").Range("A1:A5").Value2 = wb2.Sheets("Sheet1").Range("A1:A5").Value2
Thanks a bunch,
Tim G
If I can get this fixed I have two more questions LOL
' Defines variables
Dim wb1 As Workbook, wb2 As Workbook
' Disable screen updating to reduce screen flicker
Application.ScreenUpdating = False
' Define which workbook is which
Set wb1 = ThisWorkbook
ChDir "C:\"
FName = Application.GetOpenFilename
If FName <> False Then
Set wb2 = Workbooks.Open(FName)
End If
' Import range A1:A5 from Sheet1 of wb2
wb1.Sheets("VBAImport").Range("A1:A5").Value2 = wb2.Sheets("Sheet1").Range("A1:A5").Value2
' Close wb2
wb2.Close
' Re-enable screen updating
Application.ScreenUpdating = True
End Sub
Hi,
I hope someone will answer this... I am looking to have wb1 dump the copied information at the bottom of a list but am having some issues getting that done.
I have tried to include an offset but it did not work. All I am looking to do is have this select column b and add what's copied to the next cell that is open. My header starts on B5 which is my constant and everything would be pasted below that point.
wb1.Sheets("VBAImport").Range("A1:A5").Value2 = wb2.Sheets("Sheet1").Range("A1:A5").Value2
Thanks a bunch,
Tim G
If I can get this fixed I have two more questions LOL