Solved

Select entire row from any cell

Posted on 2013-02-06
5
363 Views
Last Modified: 2013-02-06
Is the a piece of code that will enable me to select the entire row and copy that row from the cell I have landed on. i.e. My macro looks for a specific word, when it finds the word it selects the cell. Lets say I am on cell P32, can I then select the entire row 32?

I am using 2010

Thank you
0
Comment
Question by:Jagwarman
5 Comments
 
LVL 17

Expert Comment

by:wobbled
ID: 38858986
If you have selected the cell it is simply


ActiveCell.Row

eg

MsgBox "The row is " & ActiveCell.Row
0
 
LVL 17

Expert Comment

by:wobbled
ID: 38858990
and if you want to go on and select that row

Dim x As Long
x = ActiveCell.Row

Rows(x).Select
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 38858993
You can select the entire row like this.
Rows(ActiveCell.Row).Select

Open in new window


And you can copy the row, without selecting, like this.
Rows(ActiveCell.Row).Copy

Open in new window

0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 38859161
or
activecell.entirerow.copy
0
 

Author Closing Comment

by:Jagwarman
ID: 38859273
brilliant
Thank you
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now