Help for creating a macro
Closed
r.rafailov
Posts
4
Registration date
Wednesday June 22, 2016
Status
Member
Last seen
June 24, 2016
-
Jun 24, 2016 at 08:11 AM
r.rafailov Posts 4 Registration date Wednesday June 22, 2016 Status Member Last seen June 24, 2016 - Jun 24, 2016 at 09:30 AM
r.rafailov Posts 4 Registration date Wednesday June 22, 2016 Status Member Last seen June 24, 2016 - Jun 24, 2016 at 09:30 AM
Related:
- Help for creating a macro
- Spell number in excel without macro - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Create a yahoo email account for free - Guide
- Create a snapchat account - Guide
- Macro excel download - Download - Spreadsheets
1 response
r.rafailov
Posts
4
Registration date
Wednesday June 22, 2016
Status
Member
Last seen
June 24, 2016
Jun 24, 2016 at 09:30 AM
Jun 24, 2016 at 09:30 AM
Sub sbVBA_To_Open_Workbook_FileDialog()
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = "False" Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Workbooks.Open Filename:=strFileToOpen
ActiveWindow.Visible = True
With ActiveSheet
.EnableSelection = xlNoSelection
End With
Dim rng As Excel.Range
Set rng = Application.InputBox("Select a range", "Obtain Range Object", Type:=8)
MsgBox "The cells selected were " & rng.Address
rng.Copy
Windows("Microsoft Excel Worksheet.xlsm").Activate
Range("A2").Select
ActiveSheet.Paste
End If
End Sub
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = "False" Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Workbooks.Open Filename:=strFileToOpen
ActiveWindow.Visible = True
With ActiveSheet
.EnableSelection = xlNoSelection
End With
Dim rng As Excel.Range
Set rng = Application.InputBox("Select a range", "Obtain Range Object", Type:=8)
MsgBox "The cells selected were " & rng.Address
rng.Copy
Windows("Microsoft Excel Worksheet.xlsm").Activate
Range("A2").Select
ActiveSheet.Paste
End If
End Sub