Error 13 please help

brujo_ds

New Member
Joined
Jul 29, 2010
Messages
10
Sorry if these is not the right place and thanks for helping me.

My problem

I have dimension lastcell as an integer or variant I cannot get these to work.

Dim lastcell As Integer
lastcell = Selection.Rows.Count

ActiveCell.Rows(" 1: & lastcell").EntireRow.Select

Thanks for all the posible help
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Try

Code:
Dim lastcell As Long
lastcell = Selection.Rows.Count
Range(ActiveCell, ActiveCell.Offset(lastcell - 1)).EntireRow.Select
 
Upvote 0
I solve it!!! But thanks you have to write it like these. I am sorry about the stupid doubt but I am very noob in vba !!!!


ActiveCell.Rows(" 1:" & lastcell).EntireRow.Select
 
Upvote 0
I solve it!!! But thanks you have to write it like these. I am sorry about the stupid doubt but I am very noob in vba !!!!


ActiveCell.Rows(" 1:" & lastcell).EntireRow.Select

You don't need the Rows property AND the EntireRow property

Code:
ActiveCell.Rows(" 1:" & lastcell).Select
 
Upvote 0
Thanks another time you are right !!!! I will change it tomorrow morning. The shorter the code is the better and I have that argument a lot of times!! So thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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