+ Reply to Thread
Results 1 to 8 of 8

Clearing volatile cell ranges

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2009
    Location
    Phoenix, Arizona
    MS-Off Ver
    2003
    Posts
    7

    Clearing volatile cell ranges

    Hello, and thanks for taking the time to stop and read my help request.

    This is extremely difficult to explain due in part to my limited knowledge of excel, but I will try my best.

    I have an excel form where a user can insert a row of information and after insertion a macro automatically sorts the data into the rest of the dataset.

    I also have it set up so that before printing, all blank cells are hidden via autofilter.

    The problem is that after printing, I would like the option to clear one column of user entered data, but only among a certain range of rows.

    So, my question boils down to: How do I clear the range when I am unsure of how many rows there will be? (If this is even possible)

    I have uploaded a screenshot of the form to give some context. Please let me know if I should upload a sample work book, although I doubt it will be any good without having to explain how to use the form.

    Thanks in advance for your tips and words of wisdom!

    [edit] What I had thought about doing was something along these lines:
    Range("C4").Select
    Range(Selection, Selection.End(xlDown)).Select
    and then utilizing "Selection.Rows.Count" in some fashion to deselect the "Header" cell/row.
    Attached Images Attached Images
    Last edited by Quail; 04-21-2009 at 06:37 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Clearing volatile cell ranges

    Hello Quail,

    After looking at the screen shot, it appears you want to clear the "Quantity" column after it has been filtered. What I'm not sure about is are you going to manually select the rows to be deleted?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-10-2009
    Location
    Phoenix, Arizona
    MS-Off Ver
    2003
    Posts
    7

    Re: Clearing volatile cell ranges

    Thank you for your response.

    I must have mis-stated something. I don't want to delete any rows, I only want to clear the contents of the column (you were correct in assuming 'quantity')

  4. #4
    Registered User
    Join Date
    04-10-2009
    Location
    Phoenix, Arizona
    MS-Off Ver
    2003
    Posts
    7

    Re: Clearing volatile cell ranges

    Not sure what the policy is on on bumping, but...

    "bump!"

    I apologize if this is against the rules. I checked the sticky and didn't see anything.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Clearing volatile cell ranges

    Think Leith was trying to give you a more tailored reply.

    See if attached help

     With Range("C4")
            .Resize(.End(xlDown).Row - 3).SpecialCells(xlCellTypeVisible).ClearContents
        End With
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Registered User
    Join Date
    04-10-2009
    Location
    Phoenix, Arizona
    MS-Off Ver
    2003
    Posts
    7

    Re: Clearing volatile cell ranges

    Thanks VBA NOOB, I think you're understanding me; However, I'm not sure I'm implementing the code you gave me correctly. It doesn't clear the entire column, only the topmost row... I'll tinker with your code to try and fix that. Thank you for your help!!

    Here's my sub:
    Public Sub clearQuantities()
    
    Dim Answer As String
    Dim MyNote As String
    
        'Place your text here
        MyNote = "Do you want to clear material quantities?"
    
        'Display MessageBox
        Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Clear Quantities?")
    
        If Answer = vbNo Then
            'Code for No button Press
            MsgBox "You pressed NO!"
        Else
            'Code for Yes button Press
    
        With Range("C4")
            .Resize(.End(xlDown).Row - 3).SpecialCells(xlCellTypeVisible).ClearContents
        End With
        
        End If
    Last edited by Quail; 04-30-2009 at 05:47 PM.

+ 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