vba copy range to new workbook

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
624
Office Version
  1. 2016
Platform
  1. Windows
Hello all,

Im needing a macro when pressed to Copy range("T:AD") to new sheet in "A1" and to copy the sheet the amount of time as the number of days in the month that's in "AD1"

Ex. if AD1=12/1/2020 then to copy the sheet 31 times as there are 31 days in December.
with each New sheet to change the value in "K1" to next day. and rename the sheet to value of "K1" with the "DD" format.

any help is greatly appreciate.
 
This is really strange. The name of each sheet changes but not the value. not sure what could be wrong. I really appreciate your help
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
[
Sheets("Ramp SUP").Columns("T:AD").Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Columns("L:O").Hidden = True
Next
End Sub[/CODE]

See above adjustments that I have made. AD1 still has the date 12/1/2020 when T:AH is copied to new sheet in A1 the date is in K1 on each new sheets however with my model it does not add the day to K1 of each sheet. It does name each sheet as 01,02,03,... etc up to the end of the month however in all sheets "02" to all last sheet "31" value in K1 is 12/1/2020. The value of K1 in sheet "02" should be 12/2/2020, Value in K1 in sheet "03" should be 12/3/2020..etc.

I have no idea what you are trying to do here. It appears to be beyond the scope of the original thread and should be started as a new thread.
Regards, JLG
 
Upvote 0
This is really strange. The name of each sheet changes but not the value. not sure what could be wrong. I really appreciate your help
The dt variable is based on the value in cell K1 of the original worksheet that was active at runtime. That dt variable is incremented by 1 to name the sheets. I don't know for sure, but it seems that you expect the value in K1 to change, but this code does not do that. The code does the incrementing and applies the calculated value as the new sheets names.
 
Upvote 0

Forum statistics

Threads
1,215,594
Messages
6,125,723
Members
449,255
Latest member
whatdoido

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top