sanantonio
Board Regular
- Joined
- Oct 26, 2021
- Messages
- 71
- Office Version
-
- 365
- Platform
-
- Windows
Hi All,
Might not be the last bit of help I need on my current project.
Essentially I'm building a code that opens a new workbook, save it as "CELL VALUE (U2)" (Which is a concat of site and =today() ). Issue is after it opens and saves I need to copy and paste values into it. Then save and close.
Pretty sure I can do the code for saving and closing, but need a little help with the copy and paste part.
Code I have is
I've stress tested this copy and paste code, replacing the ?????s with the actual filename (Manually typed in) and it works. But as the filename is fluid and will change dependent on site and date I really need the two ???? sections to be a cell value U2.
I'd love to know how to substitute a part of VBA code for a cell value as this would not only help me with this coding predicament but also others in the future.
Thanks for your help! I've been struggling with this for last couple of hours, google isn't saving me today!
Might not be the last bit of help I need on my current project.
Essentially I'm building a code that opens a new workbook, save it as "CELL VALUE (U2)" (Which is a concat of site and =today() ). Issue is after it opens and saves I need to copy and paste values into it. Then save and close.
Pretty sure I can do the code for saving and closing, but need a little help with the copy and paste part.
Code I have is
VBA Code:
Set wb = ThisWorkbook
wb.Sheets("Export").Range("A1:I283").Copy
Workbooks.Open ("?????")
Workbooks("?????").Worksheets("Sheet1").Range("A1").PasteSpecial xlPasteValues
I've stress tested this copy and paste code, replacing the ?????s with the actual filename (Manually typed in) and it works. But as the filename is fluid and will change dependent on site and date I really need the two ???? sections to be a cell value U2.
I'd love to know how to substitute a part of VBA code for a cell value as this would not only help me with this coding predicament but also others in the future.
Thanks for your help! I've been struggling with this for last couple of hours, google isn't saving me today!