+ Reply to Thread
Results 1 to 8 of 8

Find row/cell reference with Macro

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Find row/cell reference with Macro

    Hi

    I have a table that looks like this

    A
    B
    C
    D
    Grand Total
    0
    0
    0
    0
    0
    0

    I want to find which row Grand Total is at or the Cell reference of "Grand Total"

    I recorded a macro in which I used the "Find" function to find the "Grand Total" cell (as shown below) but do I make it return the cell reference instead of just activate the cell?


    Please Login or Register  to view this content.

    Thank you.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find row/cell reference with Macro

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Find row/cell reference with Macro

    Thanks. I just realized that there is more than one "Grand Total" cell in the sheet, I thought there was only one.

    So I need to find "Grand Total" in Column E. I see you devise a message box to display the address. How I extract the row number of the address and use it in Macro.

    What I will do next is to move the "Grand Total" row of the report (from Column E to Column K) to the row below using the following code:

    Please Login or Register  to view this content.
    LastRow would be the row number of "Grand Total".

    Thank you.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find row/cell reference with Macro

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Find row/cell reference with Macro

    Thank you.

    I want to delete all the rows below "Grand Total" row using the following code

    Please Login or Register  to view this content.
    Could you help me state the first line of code in the correct format?

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find row/cell reference with Macro

    You are welcome.

    Please Login or Register  to view this content.
    Or this if you want to really "delete" the rows.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Find row/cell reference with Macro

    Hi millz

    VBA says there is a bug in the code and highlighted this part in yellow:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find row/cell reference with Macro

    Quote Originally Posted by kanonathena View Post
    VBA says there is a bug in the code and highlighted this part in yellow
    Sorry about that, remove the "After:=ActiveCell, ".

    Please Login or Register  to view this content.
    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. Macro to Find a Tab then Find a List of columms
    By chemmiah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2013, 08:10 AM
  2. Replies: 2
    Last Post: 06-12-2013, 03:48 PM
  3. Replies: 4
    Last Post: 09-18-2012, 10:54 AM
  4. Find Macro With Userform - To find a data across multiple tabs in excel
    By Testify in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-15-2012, 04:49 PM
  5. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 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