maclachlan
New Member
- Joined
- Dec 28, 2005
- Messages
- 32
I need some help automatically answering a couple of Excel questions when they pop up with the following code.
I get 2 messages:
1. There is a large amout of information on the clipboard. Do you want to be able to paste this information into another program later?.... The answer to this questions has to be yes or the rest of the code won't work.
2. Data on the clipboard is not the same size and shape as the selected area. Do you want to paste the data anyway? - I need the user to select yes, I'm not sure why this warning is coming up as the copy and paste ranges are the same. I really want the entire sheet to be copied but I can't get the code right.
Thanks to everybody that has helped me this far.
[/code]
I get 2 messages:
1. There is a large amout of information on the clipboard. Do you want to be able to paste this information into another program later?.... The answer to this questions has to be yes or the rest of the code won't work.
2. Data on the clipboard is not the same size and shape as the selected area. Do you want to paste the data anyway? - I need the user to select yes, I'm not sure why this warning is coming up as the copy and paste ranges are the same. I really want the entire sheet to be copied but I can't get the code right.
Thanks to everybody that has helped me this far.
Code:
Private Sub CommandButton1_Click()
ChDrive "h:\"
ChDir "h:\"
Filt = "Excel Files (*.csv), *.csv"
FilterIndex = 5
Title = "Please select a different File"
Filename = Application.GetOpenFilename(FileFilter:=Filt, _
FilterIndex:=FilterIndex, Title:=Title)
If Filename = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical, "Selection Error")
Exit Sub
End If
Response = MsgBox("You selected " & Filename, vbInformation, "Proceed")
Workbooks.Open Filename
ActiveWorkbook.Sheets(1).Range("a1:bm1000").Copy
ActiveWorkbook.Close SaveChanges:=False
ActiveSheet.Paste Destination:=Worksheets("GMAC").Range("a1:bm1000")
Sheets("GMAC").Select
Selection.AutoFilter
Selection.AutoFilter Field:=12, Criteria1:="<>0", Operator:=xlAnd
Sheets("Instructions").Select
End Sub