get single cell name..
-
how to get the singel cell name in the sheet. i = 1, j=2 Dim str As String str = Cells(i, j).Name I excepted str = "B1" but I got run time error... Can anyone tell me why? thanks
"B1" is not a cells name, that's it's position. You can give names to cells or a range of cells in Excel for the purpose of easing calculation. For example, if a cell has a value of 2.142.... and you name it PI, then in your formulas,you can refer to it as PI like so:
=B2 + PI
which would make more sense. So, the cell.name propert returns the name of the cell, not the position. If it doesn't have a name, you get a run-time error Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
Get your facts first, and then you can distort them as much as you please Mark Twain -
"B1" is not a cells name, that's it's position. You can give names to cells or a range of cells in Excel for the purpose of easing calculation. For example, if a cell has a value of 2.142.... and you name it PI, then in your formulas,you can refer to it as PI like so:
=B2 + PI
which would make more sense. So, the cell.name propert returns the name of the cell, not the position. If it doesn't have a name, you get a run-time error Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
Get your facts first, and then you can distort them as much as you please Mark TwainThank you SMC, Can you please tell me how to get the position of the particular cell. and can you also check my following incorrect code please. I'm trying to wait for the user to close the excel application after they done with whatever they have to do to the excel file. where am i getting wrong and how to fix it.
Dim idProc As Long Dim hProc As Long idProc = VBA.Shell("Excel", vbMaximizedFocus) hProc = OpenProcess(PROCESS_ALL_ACCESS, False, idProc) If hProc Then Do While WaitForSingleObject(hProc, 100) = WAIT_TIMEOUT DoEvents Loop CloseHandle hProc End If
Thank you.