+ Reply to Thread
Results 1 to 2 of 2

Clearing a Range of Cells defined by a Variable Range

  1. #1
    Registered User
    Join Date
    08-20-2019
    Location
    Derby, England
    MS-Off Ver
    2016
    Posts
    7

    Clearing a Range of Cells defined by a Variable Range

    Hi,

    So my spreadsheet currently uses the variable "RowVal" which searches a column till it finds a selected value from a checkbox in a user form.

    It works off a loop:

    RowVal = 1
    Do Until Range("Proposal_Projects!C4").Cells(RowVal, 1) = cbxProjectSelection
    RowVal = RowVal + 1
    Loop

    What I am trying to do is to create a sub routine that clears all the cells within the row as well as 8 rows below it from which the "cbxProjectSelection" is found (Basically the RowVal). Issue is that most advice online suggests you use specific ranges (i.e A10:C25). Issue with this is that the range I wish to clear is variable depending on what the user wishes to clear. How can I clear cells based off a variable range?

    Many Thanks,

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: Clearing a Range of Cells defined by a Variable Range

    You can use Resize:

    Please Login or Register  to view this content.
    Rory

+ 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. Copy cells in a defined range > 0, paste in a defined cell on other worksheet
    By Jackson2806 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-04-2019, 08:52 PM
  2. [Urgent/Simple] I have a defined function and a defined range of cells. How do I do =MyFun
    By excelfriend1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2016, 07:45 PM
  3. Clear range based on cell value - clearing cells out of specified range
    By CADiphile in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2013, 02:48 PM
  4. Macro to Insert defined integer into range defined by variable criteria
    By stereofeedback in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2013, 12:33 PM
  5. [SOLVED] Using cell value to define a range (for a variable defined as a range)
    By Sccye in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-02-2012, 10:25 AM
  6. Replies: 3
    Last Post: 07-24-2006, 08:20 PM
  7. [SOLVED] Clearing all values in a User Defined Type variable
    By J Streger in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2006, 03:10 PM

Tags for this Thread

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