Share via

Select certain cells from active row

Anonymous
2010-09-30T16:51:46+00:00

What is the VBA code for selecting certain cells from the active row?  ex. in the active row I want my range to be cells 1,2,4,5,6,7.  I do not want cell 3 (activerow; column C). 

Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Anonymous
    2010-09-30T17:23:57+00:00

    You do not need to select anything to do what you want... just copy it into place. Using the code approach I posted...

    Intersect(Range("A:B,D:G"), ActiveCell.EntireRow).Copy Range("A12")


    NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-09-30T17:13:15+00:00

    If I set that range as Row1 and paste that range somewhere else, how would I do that?

    I can't just say:


    Range("A12").activate

    row1.paste


    thanks

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-09-30T17:08:06+00:00

    @Dave,

    There is an interesting side effect to your method as compared to the one I posted... your method produces a range composed of 6 individual areas (of one cell each) whereas mine produces 2 individual areas (one composed of two cells and the other composed of 4 cells). I'm not sure there would be any significant impact, code-wise, in how the OP uses the resulting range from each of our proposals, but I just thought difference between them was interesting.


    NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-09-30T17:00:38+00:00

    I think you are asking for this..

    Intersect(Range("A:B,D:G"), ActiveCell.EntireRow).Select


    NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2010-09-30T16:57:43+00:00

    I'd use something like:

    ActiveCell.EntireRow.Range("A1,B1,D1,E1,F1,G1").Select

    Cluckers wrote:

    What is the VBA code for selecting certain cells from the active row?  ex. in the active row I want my range to be cells 1,2,4,5,6,7.  I do not want cell 3 (activerow; column C).

    Thanks

    --

    Dave Peterson

    Was this answer helpful?

    0 comments No comments