Solved

Select entire row from any cell

Posted on 2013-02-06
5
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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.

691 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