+ Reply to Thread
Results 1 to 11 of 11

Clear Row Cells After Macro Runs

  1. #1
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Clear Row Cells After Macro Runs

    Hi,

    I have a shape which runs a macro (Post Services to 'Service Log'). It does post the selected rows to the 'Service Log' sheet just fine.

    My question is on the '2011 Ford F150' sheet can this also clear columns F,G,H,I, and K after running the macro and also update columns A and B from C and D for the selected services?

    Thank you I appreciate any help
    Attached Files Attached Files

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Clear Row Cells After Macro Runs

    Please Login or Register  to view this content.
    Not sure what the below statement means.

    and also update columns A and B from C and D
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Clear Row Cells After Macro Runs

    Thank you for the reply and code change. I ran it and it gets error at:

    Sheets ("2011 Ford F150"), Range("C" & r).Resize(, 7).ClearContents

    The statement means to put the date and O/D from columns C and D (these are filled when selecting check boxes) and put them in A and B.
    Last edited by xjohnson; 10-24-2018 at 01:07 PM.

  4. #4
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Clear Row Cells After Macro Runs

    Hello,

    I went back to my original code and after the code runs H,I, and K are the only ones left that need to be cleared.

    It still needs the Date and O/D updated though.

    Thank you very much for helping

  5. #5
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Clear Row Cells After Macro Runs

    I got the cells to clear with this code but I still can't figure out how to update the Date and O/D.

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285
    Quote Originally Posted by xjohnson View Post
    I got the cells to clear with this code but I still can't figure out how to update the Date and O/D.

    Please Login or Register  to view this content.
    Do you mean in sheets("2011 Ford F150")
    Col c and d copy to col a and b And same sheet

  7. #7
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Clear Row Cells After Macro Runs

    Yes on the '2011 Ford F150' sheet but only for the selected rows by the check boxes.

    Thank you

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Clear Row Cells After Macro Runs

    Quote Originally Posted by xjohnson View Post
    Thank you for the reply and code change. I ran it and it gets error at:

    Sheets ("2011 Ford F150"), Range("C" & r).Resize(, 7).ClearContents

    The statement means to put the date and O/D from columns C and D (these are filled when selecting check boxes) and put them in A and B.
    the error you were getting was caused by a typo. The comma should be a period.

  9. #9
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Clear Row Cells After Macro Runs

    See if this does what you want.
    Please Login or Register  to view this content.

  10. #10
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Clear Row Cells After Macro Runs

    Compile error:

    End If without block if

  11. #11
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Clear Row Cells After Macro Runs

    Quote Originally Posted by xjohnson View Post
    Compile error:

    End If without block if
    Actually, it is a With without and End With

    Please Login or Register  to view this content.
    Don't know why that didn't show up when I put it in the editor. Just add it in and it should then run OK.

+ 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] Macro runs quick initially then bogs down after a few runs
    By pongmeister in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-19-2017, 02:02 PM
  2. [SOLVED] current selected cell clear when macro runs
    By Willies in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-03-2016, 09:20 AM
  3. Cells Don't update when Macro Runs
    By sentinelace in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2010, 02:29 PM
  4. cells being coloured when macro runs
    By henrikstongue in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2010, 09:30 AM
  5. Macro runs only if no blank cells
    By loonylou in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2010, 01:16 PM
  6. clear msgbox while code runs.
    By Aussie_Striker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2007, 12:37 AM
  7. macro runs if I Clear a cell
    By Nimzow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2005, 11:06 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