+ Reply to Thread
Results 1 to 5 of 5

Content in a range is not clearing when i use F5 key

  1. #1
    Forum Contributor
    Join Date
    01-06-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    118

    Content in a range is not clearing when i use F5 key

    Hi,


    Below 2 lines of code is working when I run step by step (by using F8). But the code is not working properly when I use "F5".

    Workbooks("Team Update - Copy.xlsm").Sheets("TS").Range(Cells(2, 13), Cells(1000, 23)).Select
    Selection.ClearContents


    Explanation: = Each time code has to delete the contents from range M2 to W1000 in "TS" Sheet. When i use F5 key, code is not deleting the content.

    Note: Pls go through the Code and pls run the code at least 2 to 3 times each time by pressing F8 and F5 then you can observe the problem.


    thank you in advance


    regards
    shiva
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Content in a range is not clearing when i use F5 key

    firstly..you dont need to select first.

    you can just do it in one line
    Please Login or Register  to view this content.
    secondly
    you have code to clear but then you have code to repopulate with new data below
    is this why say it not clearing?

    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    01-06-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    118

    Re: Content in a range is not clearing when i use F5 key

    HI,


    Thank you for reply.


    I could not understand, Pls tell me the solution.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Content in a range is not clearing when i use F5 key

    point 2 was a question which i tried to ask without posting the whole code

    at the start of the code you clear contents with the code

    Please Login or Register  to view this content.
    then down the bottom
    you have code that populates that same area you have cleared

    Please Login or Register  to view this content.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Content in a range is not clearing when i use F5 key

    Hi,

    You have not properly qualified all the calls
    Please Login or Register  to view this content.
    otherwise the code will fail unless that is the active worksheet and workbook.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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] Clearing Sheet Content
    By Kwasimitsu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2014, 02:09 PM
  2. Cell content clearing when using Save As macro
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2013, 10:07 AM
  3. Auto Clearing Content
    By sgris in forum Excel General
    Replies: 1
    Last Post: 12-05-2012, 01:31 AM
  4. clearing content from blank cells
    By cotw in forum Excel General
    Replies: 6
    Last Post: 08-11-2012, 01:44 PM
  5. [SOLVED] Exclude column when clearing content with VBA
    By newrui in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2012, 11:37 AM
  6. [SOLVED] Clearing cells content when opening up an Excel workbook
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2012, 10:58 PM
  7. clearing cell content on MAC?
    By themachine in forum Excel General
    Replies: 4
    Last Post: 07-22-2010, 08:39 AM
  8. [SOLVED] clearing cell content in a macro
    By dziw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2007, 12:02 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