+ Reply to Thread
Results 1 to 4 of 4

Rows.Count, (??) - Variable Column Index

  1. #1
    Forum Contributor
    Join Date
    10-11-2013
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    136

    Rows.Count, (??) - Variable Column Index

    Im using Rows.Count...End(xlUp) to find the last empty row, but am getting hung up on the column index. THe Problem is, if I use "A" as the column (Rows.Count,1), and theres something in column B in the row below, I end up pasting over it unintentionally.
    I'm sure there's a simple way around this, but Google hasn't been very forthcoming as of yet...

    Clues?

  2. #2
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Rows.Count, (??) - Variable Column Index

    When I do ranges I usually do them this way. This will set a range called SomeRange on column A from row 5 to the lowest used row on column A.
    It depends on how many times you want to use the range. If it a one off use the bottom example. I made it colour the cells green to give you an idea
    cheers

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-11-2013
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Rows.Count, (??) - Variable Column Index

    Ok, Thing is I don't always know which column will have the last filled cell.
    It's part of that last code you help me with () where I wanted to Loop forever..

    Looks like I sussed it though:
    Please Login or Register  to view this content.

    Nice to see another Kiwi working late though

  4. #4
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Rows.Count, (??) - Variable Column Index

    Hi rogersmd
    Try using this code. It's basically the same with the main difference being finding the bottom row wherever it is on the worksheet & using that row instead of rows.count
    I'm not working as such, I do this for fun really. About 3 or 4 years ago the only thing I knew about a spreadsheet was the fact it was a screen full of rectangles. Then one day I had a use for one & started the learning curve.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] COUNT; IF/THEN; and variable rows in a column?... HELP?
    By sryder in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-06-2015, 10:53 PM
  2. [SOLVED] Converting Hlookup to Index Match with variable column index number
    By SimonLock in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-09-2015, 09:14 AM
  3. [SOLVED] VBA for creating Index-Match every 2 rows where INDEX refer to a different column per row
    By bisaya789 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2012, 03:46 AM
  4. Replies: 6
    Last Post: 04-14-2012, 04:07 AM
  5. Loop to Lookup Each Column and Index Variable Range of Rows
    By sienster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2011, 05:37 PM

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