VBA Selection.Column

Lara465

New Member
Joined
Mar 29, 2020
Messages
32
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello!

So I have something like this :

Dim selrow as string, selcol as string

I do an action an then I am in a specific cell and I write
selcol=Selection.Column
To keep the column number I was in

A do some other actions and I end up in another cell, this time I want tot keep the row of this current cell
celrow=Selection.Column

This is where I blocked. So I have a number in each selcol and selrow, is there a way to put them together? To tell to go select the Cell[celrow, celcol], so to use the celrow and celcolumn as a range.
Ex: if celrow = 2 and celcol= 3, to go and select the cell (2,3) ?

Thanks.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I found the answear, If I declare then as Integer not String, I can call them by using Cells(celrow,celcol).Select.
 
Upvote 0
hi, Lara

Glad you sorted that out.

I suspect it is just a typing error, but just in case, where you've got "celrow = Selection.Column" should be "celrow = Selection.Row"

regards, Fazza
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,719
Members
452,995
Latest member
isldboy

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