Find last Column in a specific row

Aswinraj

Board Regular
Joined
Dec 10, 2015
Messages
65
Hello Guys,

I need to find the Last Column of a specific Row -> Move to Next Row -> Add "X" in that specific cell.
Example: In Below Screen shot, Where in Row A9 -> Need to find last Column (J9) -> Insert "X" in Next row (K9).
Note: We cant simply specify the Cell Number and enter the data since each time cell will be changing.

i tried below formula but still unable to get what i need.

LC = ActiveSheet.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

1586145669493.png
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Where in Row A9 -> Need to find last Column (J9) -> Insert "X" in Next row (K9).
You mean next column not row.
VBA Code:
Rows(9).Find("*", , xlValues, , xlByColumns, xlPrevious).Offset(, 1).Value = "X"
Btw, it is VBA code not a formula.
 
Upvote 0
@MARK858 Yes you are right.., its a Column but i am getting an error as below,

I tired the same formula to add next to last pivot column.

1586154712925.png
 
Upvote 0
You can't add the x if it is within the Pivot table range using that method, it is a calculated field.
 
Upvote 0
@MARK858 Yes Sir.., but i am Pivot table range ends at Column J (Which is the last column in Pivot table.., and i am trying to add "X" in K column.

In Simple, i am trying to add "X" in a column next to last available Pivot table column.
 
Upvote 0
The code works fine for me if the cell the x is being inserted in is outside the Pivot table .
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,098
Members
449,205
Latest member
ralemanygarcia

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