Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. get single cell name..

get single cell name..

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pnpfriend
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • P pnpfriend

      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

      N Offline
      N Offline
      Nick Seng
      wrote on last edited by
      #2

      "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

      P 1 Reply Last reply
      0
      • N Nick Seng

        "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

        P Offline
        P Offline
        pnpfriend
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups