Totaly noob trying to learn how to selest last sheet.

agas

New Member
Joined
Mar 22, 2011
Messages
41
Hello,

I have created and used macros using record option never tried to do something specific.
So i need some help pls :)

Rigth now i am trying to move open files to move in to a specific workbook. The workbooks name is always the same but the sheets i want to add in to it changes.

I want it to select the last sheet after i run this. And keep addind the next sheet after the one previously added.

Sub moveto()
ActiveSheet.Select
ActiveSheet.Move After:=Workbooks( _
"TK_LO_CAP_REP.xls").ActiveSheet
ActiveSheet.Next.Select
End Sub

This does what i want but it turns an error. Object variable or With block variable not set.

Something else

Is it possible to have a user input a data and make excel delete the other data ?

Like I have data in column A tim, zim, kim and i want to keep row that have tim in column A.

And is it possible to have users enter what they want to keep ? They type tim to keep tim or kim and zim to keep both.

Thanks in advance.
Alp
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try:

Code:
With Workbooks("TK_LO_CAP_REP.xls")
    ActiveSheet.Move After:=.Worksheet(.Worksheet.Count)
End With

Note that when you move a worksheet it becomes the ActiveSheet.
 
Upvote 0
Sorry, typo:

Rich (BB code):
With Workbooks("TK_LO_CAP_REP.xls")
    ActiveSheet.Move After:=.Worksheets(.Worksheets.Count)
End With
 
Upvote 0

Forum statistics

Threads
1,224,575
Messages
6,179,637
Members
452,934
Latest member
Jdsonne31

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