Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Chalenge ! Unable to figure out how to do this.

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Adam
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a spread sheet that I need to select a range of cells The goal is to create this selection based on the the last position of data on the first column, I now how to do this with rows but unable to to do this with this situation.
    Thanks Please let me know if you need futher clarification.

    Please a see the table below.

    J K L M N
    Symbol Company Name Last High Low Volume High Low
    lwin
    lwin THIS IS THE AREA NEED TO SELECT THE SELECTION SHOULD START K3 & END ON COLUMN Z BASED ON THE LAST CELL REFERENCE THAT HAS DATA FROM COLUMN J , THIS WILL CHANGE EVERY DAY.
    lwin
    lwin
    lwin
    lwin
    lwin
    lwin

    LAST CELL REF

  2. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    Try,

    Sub test()
    Dim lastrow As Long

    lastrow = Cells(Rows.Count, "J").End(xlUp).Row
    Cells(lastrow, "J").Offset(0, 1).Resize(1, 16).Select
    End Sub

    HTH,
    Jay

  3. #3
    New Member
    Join Date
    Apr 2002
    Location
    Adam
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks that worked out great!

  4. #4
    New Member
    Join Date
    Apr 2002
    Location
    Adam
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    One more question. Now that I have selected the bottom of the area I want, how do I basically hold downt he shift key and select the range up to one row before the top?

  5. #5
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    Rewrite the routine to do what you want. I don't know exactly what you need, so try the following. I have commented out another option, too.

    '-------------
    Sub test()
    Dim lastrow As Long, firstrow As Long

    lastrow = Cells(Rows.Count, "J").End(xlUp).Row
    firstrow = Cells(lastrow, "J").End(xlUp).Row

    If lastrow = 1 Then
    Cells(lastrow, "J").Offset(0, 1).Resize(1, 16).Select
    Else
    Range(Cells(2, "K"), Cells(lastrow, "Z")).Select

    '''' or use something like this
    '''' Range(Cells(firstrow + 1, "K"), Cells(lastrow, "Z")).Select
    End If

    End Sub
    '--------------

    Bye,
    Jay

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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