Selecting Last Row and Rows with specific words

ExcelNoob222

Board Regular
Joined
Jun 17, 2020
Messages
77
Office Version
  1. 365
Platform
  1. Windows
Hi,

My first issue is I am trying to select the last row of my data from column A to K. The below code selects the right cell in column A but I cant seem to figure out how to get the selection to column K.

VBA Code:
LastRowFormat = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LastRowFormat).Select

I have tried:
Code:
LastRowFormat = Range("A" & Rows.Count).End(xlUp).Row
Range("A:K" & LastRowFormat).Select
and
Code:
LastRowFormat = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LastRowFormat & "K").Select

Any ideas?

My second issue. I have another tab with subtotal rows. I want to be able to select all of the subtotal rows and highlight them and put thick border around. Any easy way to do this?

Thanks!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try:
VBA Code:
Sub x()
    LastRowFormat = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & LastRowFormat).Resize(, 11).Select
End Sub
Fore the subtotal rows issue, it would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
Try:
VBA Code:
Sub x()
    LastRowFormat = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & LastRowFormat).Resize(, 11).Select
End Sub
Fore the subtotal rows issue, it would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).

This is great! That solved my first issue. For my second, I was able to get it! Thanks again.
 
Upvote 0
You are very welcome. :)
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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