|
-
Dec 27th, 2009, 07:58 PM
#1
Thread Starter
New Member
[RESOLVED] Simple but stuck
writing in excel 2003
i am trying to copy and rename an excel workbook but i cant seem so sort it out.
the dates need to start on 01-01-10 and finish 31-12-10
the code i have been working on is below. but i cant find out what the problem is???? please help
Dim nyear As Date
nyear = Format(Now(), "dd-mm-yy")
Do Until nyear = "31-12-10"
FileCopy Source:="M:\settings\Desktop\monthmaster.xls", Destination:="M:\settings\Desktop\" & nyear & ".xls"
nyear = nyear + 1
Loop
End Sub
-
Dec 27th, 2009, 11:01 PM
#2
Re: Simple but stuck
Try something like this... 
Code:
Dim nyear As Date
nyear = DateSerial(2010, 1, 1)
While nyear <= DateSerial(2010, 12, 31)
Debug.Print nyear
FileCopy Source:="M:\settings\Desktop\monthmaster.xls", Destination:="M:\settings\Desktop\" & Format(nyear, "dd-mm-yy") & ".xls"
nyear = DateAdd("m", 1, nyear) '~~~> adds 1 month (for more info: http://www.vb6.us/tutorials/understanding-vb6s-dateadd-function)
Wend
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Dec 28th, 2009, 01:07 PM
#3
Re: Simple but stuck
Moved To Office Development
-
Dec 28th, 2009, 02:15 PM
#4
Thread Starter
New Member
Re: Simple but stuck
spot on thaky you very much.
and merry xmas
-
Dec 29th, 2009, 12:09 AM
#5
Re: [RESOLVED] Simple but stuck
spot on thaky you very much.
Glad to hear that... 
Happy new year...!
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 3rd, 2010, 02:32 PM
#6
New Member
Re: [RESOLVED] Simple but stuck
I believe I have 2 similar problems
1. How do I paste my copied cells into workbook "Y"?
2. The data is pulled from SAP and has a fair amount of information about the data pull at the top of the spreadsheet. The amount of data may vary, making the row I sort on, 56, inappropriate. Is there a way to sort under a specifically named cell(s)?
This is a hodgepodge of code thrown into one macro, if there is a way to re-tool, please feel free.
Thank you for the help.
Code:
Sub Macro2()
'
' Macro2 Macro
'
'
Dim wbbook As Workbook
Dim thiswbbook As ThisWorkbook
strSecondFile = "Workbook x"
Set wbk = Workbooks.Open(strSecondFile)
With wbk.Sheets("Sheet1")
Rows("56:56").Select
Selection.AutoFilter
ActiveSheet.Range("$A$56:$AC$30015").AutoFilter Field:=3, Criteria1:="XXXX"
Range("G57:J57").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
*GO BACK TO WORKBOOK Y*
Range("FILLDOWN_START_ROWCOUNT").Select
ActiveSheet.Paste
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|