Consulting

Results 1 to 15 of 15

Thread: VBA to select cell in active row

  1. #1
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location

    VBA to select cell in active row

    hi all,

    can someone help me with simple code

    i need a code to select a cell range in active row;

    thanks

  2. #2
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,710
    Location
    Given .Cells(n) where n is a column number
    ActiveCell.EntireRow.Cells(n).Select
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    thanks SamT,

    so instead of entire row if i want to specify range A-E what needs to be changed there?

  4. #4
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    Hi Torpido.

    I don't want to sound rude, but this is a VBA Help Site, not a School.

    There are thousands of tutorials out there on the web, I suggest you spend some time learning the basics of VBA.

    There is also a Macro Recorder in Excel. Try that. Google is your buddy!
    Semper in excretia sumus; solum profundum variat.

  5. #5
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    sorry but i dont have much use of VBA this is just small thing on my hand, nothing that i cant live without but it would be a help if this is done; Micro recorder... tried it, unfortunitly i dont have just a Row its whole sheet so do the math

    Btw google brought me here!

  6. #6
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    Range("A" & ActiveCell.Row & ":E" & ActiveCell.Row).Select
    Semper in excretia sumus; solum profundum variat.

  7. #7
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,710
    Location
    ActiveCell.EntireRow.Range("A1:E1").Select
    We Help. We Teach. We Guide. We Tutor. We Train. We Blog. We produce a Newsletter. We Consult. We produce videos. We hold Webinars. We provide complete integrated MS Office applications.

    VBA Express is so much more than just a help forum.

    http://www.vbaexpress.com/
    http://www.vbaexpress.com/training.html
    http://www.vbaexpress.com/excel-academy.html

    https://www.youtube.com/user/VBAExpress/
    .
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  8. #8
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    I stand corrected
    Semper in excretia sumus; solum profundum variat.

  9. #9
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    thanks Paul, it worked like charm... mybe you motivate me to learn VB after all


    also thanks SamT, kind words

  10. #10
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    VBA is a very powerful tool to have in the toolbox, it is well worth the effort of learning it
    Semper in excretia sumus; solum profundum variat.

  11. #11
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    hey Paul

    just one more quick one, please

    in above code, after selecting A to E, ive added to copy the selection, then i want it to go to select column F Next row

    thanks

  12. #12
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    duplicate post
    Last edited by TORPIDO; 04-21-2020 at 10:51 PM.

  13. #13
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    after selecting A to E, ive added to copy the selection, thereafter i want it to select Cell "F" of row below
    Last edited by TORPIDO; 04-21-2020 at 10:50 PM.

  14. #14
    So maybe explain what you want to do, including the selecting A to E, which normally should not be required.
    Some examples:
    Range("F1:J1").Value = Range("A1:E1").Value
    or
    Cells(1, 1).Resize(, 5).Copy Cells(1, 6)
    or
    Cells(1, 6).Resize(, 5).Value = Cells(1, 1).Resize(,5).Value
    and a lot other possibilities.

  15. #15
    VBAX Regular
    Joined
    Apr 2020
    Posts
    8
    Location
    this worked

    range("F" & ActiveCell.Row + 1).Select
    thanks all

Posting Permissions

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