PC Review


Reply
Thread Tools Rate Thread

Converting Excel Cell Location into X and Y Coordinates

 
 
skulkrinbait@googlemail.com
Guest
Posts: n/a
 
      6th Jun 2007
I'm using Excel to create a screen designer utility with a VBA macro
which will take the screen once designed and output source code which
can then be compiled to actually display the screen in the environment
it is designed for.

One problem I have is I need to convert the positions of the various
fields from their Excel format ie "C3" into x and Y coordinates, so
foir example "I14" becomes 9,11. I'm using a range loop to go through
the screen picking out the fields:

For Each sMainScreen In Range("C4:CA21")

.............

Next sMainScreen

But how can I write something to work out each location as it finds
the fields?

Thanks for any assistance, hope it's clear enough.

 
Reply With Quote
 
 
 
 
skulkrinbait@googlemail.com
Guest
Posts: n/a
 
      6th Jun 2007
Maybe it wasn't clear enough.

In essence what I need to know is what cell is being processed at each
stage of the loop. Is there anyway of finding that out?

I can then somehow split the range (eg D11) into it's x and y
components and work out the x and y coordinates.

Anyone know if this can be done?

 
Reply With Quote
 
skulkrinbait@googlemail.com
Guest
Posts: n/a
 
      6th Jun 2007
I've managed to achieve my objective with a bit of a fudge, just
having x and y variables which I increment accordingly after each pass
of the loop, or every 80 passes for the y coord.

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      7th Jun 2007
Is this what you mean ?

With Range("A1")
Debug.Print .Left, .Top
Debug.Print .Width, .Height
End With

You would also need to allow for the Application.WindowState and possibly
position, along that of the Window.

Or if you mean using a For Each loop on a Range:

Dim Cell As Range

For Each Cell In Range("B3:G15")
With Cell
Debug.Print "(" & .Row & "," & .Column & ") = " & .Value
End With
Next

NickHK

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm using Excel to create a screen designer utility with a VBA macro
> which will take the screen once designed and output source code which
> can then be compiled to actually display the screen in the environment
> it is designed for.
>
> One problem I have is I need to convert the positions of the various
> fields from their Excel format ie "C3" into x and Y coordinates, so
> foir example "I14" becomes 9,11. I'm using a range loop to go through
> the screen picking out the fields:
>
> For Each sMainScreen In Range("C4:CA21")
>
> ............
>
> Next sMainScreen
>
> But how can I write something to work out each location as it finds
> the fields?
>
> Thanks for any assistance, hope it's clear enough.
>




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Lat/Lon coordinates to Decimal Cheese Microsoft Excel Misc 4 25th Jun 2009 11:12 PM
How do I get the coordinates of the active cell in Excel? =?Utf-8?B?SmltIFN0dWFydA==?= Microsoft Excel Misc 8 17th Jun 2007 09:28 PM
how do i get location coordinates for my control =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 0 11th May 2005 04:26 PM
Converting MouseDown Coordinates to Chart Point Coordinates Steve Microsoft Excel Programming 3 2nd Dec 2003 06:48 PM
Converting Coordinates in Excel Johnny Blood Microsoft Excel Misc 7 10th Jul 2003 07:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:45 AM.