VBA extract column/ row value from address string

Hile_Troy

New Member
Joined
Sep 27, 2011
Messages
15
Hi Folks

I am trying to work out how to get column/ row values from an address string. the relevant code I am using is:-

DivCell = Cells(DivRow, DivCol).Address
EndCell = Cells(ExpRow, ColMax).Address
If Not Intersect(Target, Range(DivCell, EndCell)) Is Nothing Then
Target.Address... 'This is where the problems start
End If

The code works fine, I can display the address in a message box and all is good, what I want to do is to insert a value into a cell that is in the same column but a different row than Target.

I cannot use a fixed offset as that would not work for my project.

Can anyone help? Please.
 
No way can you simply reference target.row and target.col. I at the same time love it and hate it when an answer is so simple it makes me feel stupid. I'll give it a try, thanks Steve059L
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Big thanks to srikanth.nm and SteveO59L. I have used the Target.Row/ Target.Column solution and it works a treat, thanks guys.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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