SushiJuice
New Member
- Joined
- Jan 20, 2022
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
HI there. I'm trying to:
- Copy a range and paste it into another sheet (could I create one on the fly?)
- Then create a temporary workbook to copy the same information (could I eliminate the step above instead?)
- Then save the new file as a .txt file on the desktop with a specific name
- I'd like to then delete the temporary workbood (if that's possible - can't figure out how to do that)
VBA Code:
Range("M3:M241").Select
Selection.Copy
Sheets("Sheet1").Select
Range("a1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Range("A1").Select
Filename = ActiveWorkbook.Name
user = Environ("Username")
desktop = "C:\Users\" & user & "\Desktop\"
newfilename = "TMO_" & Format(Now, "yyyymmdd")
ThisWorkbook.SaveAs Filename:=desktop & newfilename & ".txt", FileFormat:=xlTextWindows
End Sub