Find Last Entry In Columns

nehpets12

Active Member
Joined
Feb 22, 2002
Messages
453
I have 5 columns B to I in these I have either 1 or 0.5 I need a macro that that goes down to the last entry in any of these columns and selects the entry in I.

I am setting it up to create a print area A1 to the active cell I hope this is clear.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The routine below will get to the last row.

There are actually 8 columns between B and I so I have assumed that you wanted all of these included in the search and included the code in the macro.

***

Sub FindLastRow()

Dim AmILast(8)
Dim Biggest As Double
Dim PrtRng As String
Biggest = 0
For a = 1 To 8
Range("A65535").Offset(0, a).Select
Selection.End(xlUp).Select
AmILast(a) = ActiveCell.Row
If AmILast(a) > Biggest Then Biggest = AmILast(a)
Next

PrtRng = "A1:I" & Biggest

' Range(PrtRng).Select
ActiveSheet.PageSetup.PrintArea = PrtRng

End Sub
 
Upvote 0
Thank you for your help I forgot I had 3 columns hidden I only need to find this data in columns B C G H I sorry if this is harder apart from that it was just what I wanted
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,266
Members
448,558
Latest member
aivin

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