ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get_Cell_Number (https://www.excelbanter.com/excel-programming/450755-get_cell_number.html)

[email protected]

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


Claus Busch

Get_Cell_Number
 
Hi,

Am Fri, 3 Apr 2015 08:21:13 -0700 (PDT) schrieb :

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

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


what do you want as result? Row number, column number, column character
or cell address?


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

[email protected]

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).

Claus Busch

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

[email protected]

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()

isabelle

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()



isabelle

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


All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com