Results 1 to 4 of 4

If Statement to Check if a Particular Row is Selected

Threaded View

  1. #1
    Registered User
    Join Date
    07-14-2014
    Location
    Los Angles, United States
    MS-Off Ver
    2007
    Posts
    12

    If Statement to Check if a Particular Row is Selected

    I have a macro right now which makes a selection and then checks that selection to make sure it has less than 5,000 rows. If it has more, then a message box appears and we end the macro. However, in order for this macro to work properly for me, I need to change the if statement so that instead of checking for the amount of rows selected, I only need it to check if ROW 2 is selected. Is this possible? If not, can we have an IF statement to check the contents of ROW 2 (Row 2 is my header on the worksheet and will never change)? Here is the code I currently have:

    Range("F2").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(0, -5).Select
    Range(Selection, Selection.End(xlUp)).Select
    If Selection.Rows.Count > 5000 Then
        MsgBox ("ERROR, Enter Data Description First")
        ActiveCell.Offset(1, 1).Select
        ChoosePrj.Hide
        Exit Sub
    End If
    Selection.FillDown
    Last edited by excel6000; 07-18-2014 at 12:58 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Check if SpecialCells are selected
    By bsamuels in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:32 PM
  2. How to check if selected cell is in row 10
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2009, 12:41 AM
  3. Check selected cells for info
    By adam2308 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-08-2009, 07:09 AM
  4. VBA - Check if selected worksheets exist
    By Lucifix in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2009, 05:04 AM
  5. How do I check the number of rows selected
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-08-2006, 08:30 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1