+ Reply to Thread
Results 1 to 2 of 2

Variable time period/cell reference

Hybrid View

  1. #1
    Registered User
    Join Date
    11-28-2006
    Posts
    55

    Variable time period/cell reference

    Help!

    I'm writing some VBA that needs to refer to a cell in which the user will have input the time period they are interested in.
    The macro needs to clear the contents outside of this time period and blank out the cells. (see example)
    I can work out most of it but i cannot work out how to indicate which range of cells need to be cleared and blanked.

    Any help would be great thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Assuming that your cell to nominate the number of years is C3, and your data is in row 7 with your first reference cell being B7 then

    Range("B7").Resize(1, Range("c3").Value).Select
    would select the relevant range. However, if you are just clearing the entries, then you don't need to select it first

    Range("B7").Resize(1, Range("c3").Value).ClearContents
    would just clear it out.

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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