Results 1 to 6 of 6

Thread: VBA save a cell address(only number) as variable

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA save a cell address(only number) as variable

    How can i save only the number of active cell address as a variable in vba code
    for example cell address is I$I4078 and in need 4078

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,190
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: VBA save a cell address(only number) as variable

    How about
    Code:
       Dim Rw As Long
       Rw = ActiveCell.Row
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    New Member
    Join Date
    Aug 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA save a cell address(only number) as variable

    Quote Originally Posted by Fluff View Post
    How about
    Code:
       Dim Rw As Long
       Rw = ActiveCell.Row
    I really appreciate
    would you help me on this please, it seems there is a problem in last line

    Dim LCNum As Long
    Range("I2").Select
    Selection.End(xlDown).Select
    LCNum = ActiveCell.Row
    Range("E2: E " & LCNum & "").Select

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,190
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: VBA save a cell address(only number) as variable

    Try
    Code:
    Dim LCNum As Long
    Range("I2").Select
    Selection.End(xlDown).Select
    LCNum = ActiveCell.Row
    Range("E2:E" & LCNum).Select
    or simpler
    Code:
    Range("E2:E" & Range("I2").End(xlDown).Row).Select
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  5. #5
    New Member
    Join Date
    Aug 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA save a cell address(only number) as variable

    thanks a lot

  6. #6
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,190
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: VBA save a cell address(only number) as variable

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •