vbachanger
New Member
- Joined
- Sep 15, 2021
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
Hi Guys, in the code below, I want to add /FileA before the file extension. [Filename/FileA.csv]
In the code below, I want to copy only values from wsCopy to wsDest. The following part is not working currently: [PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False]
ThankU!
VBA Code:
Sub rename()
Dim strFile As String
strFile = ThisWorkbook.FullName
strFile = Left(strFile, InStrRev(strFile, ".")) & "csv"
Range("A1:C6").Copy
Workbooks.Add xlWBATWorksheet
ActiveSheet.Range("A1").PasteSpecial xlPasteValues
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=strFile, FileFormat:=xlCSV
End Sub
In the code below, I want to copy only values from wsCopy to wsDest. The following part is not working currently: [PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False]
VBA Code:
Sub Copy_Paste_Below_Last_Cell()
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lCopyLastRow As Long
Dim lDestLastRow As Long
Workbooks.Open "C:\Users\currentuser\Data.xlsx"
Set wsCopy = Workbooks("Data.xlsx").Worksheets("Export")
Set wsDest = Workbooks("Reports.xlsm").Worksheets("All Data")
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "A").End(xlUp).Row
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1).Row
wsCopy.Range("A2:D" & lCopyLastRow).Copy _
wsDest.Range("A1")[B].[/B]PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
wsDest.Activate
Workbooks("Data.xlsx").Close SaveChanges:=True
End Sub
ThankU!