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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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