Selection.Item Query

  • Thread starter Thread starter skulkrinbait
  • Start date Start date
S

skulkrinbait

I'm using a macro to allow a user to design a form, part of the macro
is thus:

sLeft = Selection.Item(1).Address
sRight = Selection.Item(Selection.Count).Address
iTotalcells = Selection.Count
sRange = sLeft + ":" + sRight

What I need to do is work out the x and y coordinates of the upper
left cell that the user is selecting, so "A1" would be x =1 and y =1
while "C6" would be x = 3 and y = 6 and so on.

How can I do that?

Thanks for any assistance.
 
Why do you build that formula manuall

sLeft = Selection.Item(1).Address
sRight = Selection.Item(Selection.Count).Address
iTotalcells = Selection.Count
sRange = sLeft + ":" + sRight

could be replaced with


sRange = Selection.Address

You are using a fairly advanced technique to break out information which you
reassemble back to the original information.

to further illustrate.

if selection.Areas.count = 1 then
yTop = selection(1).Row
xLeft = selection(1).coluimn
yBottom = selection(selection.count).Row
xRight = selection(selection.count).column
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top