Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Get_Cell_Number

How can I do this the other way round?

Sub Get_Cell_Number()
MsgBox Cells(1).Address
End Sub

e.g. Cells(1,1)
'result = 1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Get_Cell_Number

On Saturday, April 4, 2015 at 2:21:17 AM UTC+11, wrote:
How can I do this the other way round?

Sub Get_Cell_Number()
MsgBox Cells(1).Address
End Sub

e.g. Cells(1,1)
'result = 1


The Cell number as in Cells(1,1) is the same as Cells(1)
Cells(1,2) is the same as Cells(2).
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Get_Cell_Number

Hi,

Am Fri, 3 Apr 2015 08:27:42 -0700 (PDT) schrieb :

The Cell number as in Cells(1,1) is the same as Cells(1)
Cells(1,2) is the same as Cells(2).


try:
MsgBox Cells(1, 2).Column


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Get_Cell_Number

On Saturday, April 4, 2015 at 2:21:17 AM UTC+11, wrote:
How can I do this the other way round?

Sub Get_Cell_Number()
MsgBox Cells(1).Address
End Sub

e.g. Cells(1,1)
'result = 1


Hi Claus,
That gives the column number.

I want the opposite of this:

MsgBox Cells(16385).Address()


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Get_Cell_Number

hi,

Sub Macro1()
n = 32768
rws = Columns.Count
If n < rws Then
rw = 1
clm = n
Else
If n Mod rws = 0 Then
rw = Int(n / rws)
clm = Columns.Count
Else:
rw = Int(n / rws) + 1
clm = n Mod rws
End If
End If
MsgBox Cells(rw, clm).Address()
End Sub

isabelle

Le 2015-04-05 17:07, a écrit :

I want the opposite of this:

MsgBox Cells(16385).Address()


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Get_Cell_Number

for a better understanding of this macro, i changed "rws" to "clms"

Sub Macro1()
n = 32769 ' xl2007 + -- 16384(XFD1) 32768(XFD2)
clms = Columns.Count
If n < clms Then
rw = 1
clm = n
Else
If n Mod clms = 0 Then
rw = Int(n / clms)
clm = Columns.Count
Else:
rw = Int(n / clms) + 1
clm = n Mod clms
End If
End If
MsgBox Cells(rw, clm).Address()
End Sub


isabelle
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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



All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"