Select Rows With Value

IoanZ

Board Regular
Joined
Mar 2, 2018
Messages
51
Hello to everyone
I have this situation
In Range(A1:A6) i put some values.

My activecell is A7.

I want to know which is vba code to select Cells from the top rows of activecell(including activecell) until i find a blank row.

As result Range(A3:A7) will be selected.

Thank's a lot


Row/CollABCD
165
2
335
460
585
621
7
8
9

<tbody>
</tbody>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Resolved With this
Sub AutoSUM()
Range("A" & ActiveCell.Row).Select ' activecell below the range of numbers
Range("B" & ActiveCell.Row).Value = "x"
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlUp)).Select
Cells(Range("B150").End(xlUp).Row, 1) = Application.WorksheetFunction.Sum(Selection)
Cells(Range("B150").End(xlUp).Row, 2).ClearContents
End Sub
 
Upvote 0
This will do as you ask
Code:
Range(ActiveCell, ActiveCell.Offset(-1).End(xlUp)).Select
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,577
Members
449,039
Latest member
Arbind kumar

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