Add text after the last column.

johnnyvv

New Member
Joined
May 26, 2008
Messages
16
I want to add text after the last column in a macro
in the spreadsheet but dont know what the last will be.

So if the data ends in column 'T' i want to add the word ''last'' into column 'U'. But i wont know what the last column will be.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
if you know the row and
a) there are no blanks in the data you can use

range("A1").end(xltoright).column

b) there are blanks in the data you can use

range("IV1").end(xltoleft).column

in your example both of these will return 20 (the number equivalent of T)

so you can do something like

cells(1,(range("IV1").end(xltoleft).column + 1)) = "last"
 
Upvote 0
hmm tried but it didnt work.

Just want to add the text ''Last''
into row 13 after the last column.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

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