move worksheet to end of another workbook

S

scooke

Hi,
I'm using Excel 2010 and have two spreadsheets that I want to merge.
One of these is my timesheet workbook (called "breakdown 2013.xlsx") and the other is my daily time.
I have managed to create a macro that will mostly do what I want, but I cannot find the code to get the daily sheet to insert at the end of the "breakdown" without having to constantly change the number of sheets.

The code I'm using is :

ActiveSheet.Select
ActiveSheet.Move after:=Workbooks("breakdown 2013.xlsx").Sheets(135)

Can anyone assist with this - it's irking me no end.
 
S

scooke

It inserts it at the 2nd worksheet.

I do have other code before this bit (not that that should make a difference?)

Cells.Select
Selection.Columns.AutoFit
Columns("B:C").Select
Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
Selection.ColumnWidth = 13.86
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Range("A18").Select

Cells.Select
Selection.Replace What:="*DAY>", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

ActiveSheet.Select
ActiveSheet.Move after:=Workbooks("breakdown 2013.xlsx").Sheets(Sheets.Count)

Is this causing a problem - have I left something out, or put too much in ? Should this be a separate code ?
 
S

scooke

Oh sweet !!
That works now - thank you soooo much.
I'm not terribly proficient with VBA, but can "get by" or resort to asking my husband - although he couldn't help with this one.
The code was originally created by my creating a macro and then "going thru the motions". That's prob'ly why it's so convoluted ?
Now it works brilliantly.
Again, thank you so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top