excel2007uk
New Member
- Joined
- Jul 13, 2018
- Messages
- 13
Hi I am trying to create a button that can copy the activesheet range "A1:H28" from a workbook called Quotation 3 & paste to a new excel spreadsheet, then save the file name as K3 from worksheet "Quote" from workbook "Quotation 3" then save this in "C:\Users\" & username & "\Dropbox\QUOTES\"
I would like to keep the format & column widths if possible, can anyone help? I'm running into an error at .pasteSpecial however I belive their might be a few more issues with this...
I would like to keep the format & column widths if possible, can anyone help? I'm running into an error at .pasteSpecial however I belive their might be a few more issues with this...
VBA Code:
Sub copyintonewworkbook()
ActiveWorkbook.ActiveSheet.Range("A1:H28").Copy
Dim FName As String
Dim FPath As String
Dim username As String
username = Environ$("username")
Set NewBook = Workbooks.Add
With NewBook
.SaveAs
FPath = "C:\Users\" & username & "\Dropbox\QUOTES\"
FName = ActiveWorkbook.ActiveSheet.Range("K3").Text
ThisWorkbook.SaveAs Filename:=FPath & "\" & FName
End With
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub