clear

  1. gheyman

    Clear Range code error if range is already empty

    I have code to clear a named range. It works great if there is data in the range. But if the range is empty, I get an error. I want to check to see if the named range has data before I run code (if that's the smart way). Help Please. Not sure how to check or if I should stop macro if error...
  2. B

    clear contents in one column based on text in another column

    Hi, If someone could help me? I'm looking for vba code to clear the contents of a cell in column A if the cell in column D has specific text. ie If column D contains "Sample" then clear the contents of column A.
  3. kelly mort

    Clear contents from the "Excel Folder" in the drive C

    Hello Geniuses, How do I locate and clear the contents of the "Excel Folder" located under the "AppData" folder? I mean with a vba code. Thanks
  4. A

    Userform clear labels function

    How can I clear all the labels with a code on userform UserForm_Initialize() instead of wring below codes one by one? Me.Label1.Caption = ("") Thanks
  5. C

    Clear Contents Value, Move to Next Cell in Column

    Hello, I need some help on a macro I am attempting to create. I am completely new to VBA so am struggling a bit with the proper macro to make my desired outcome work. I created a formula in Excel which adds 0s to cells when a condition is met. Ultimately, I need that cell clear of the 0 in...
  6. D

    Clear Range on Hidden Sheet

    Hello I cannot work out why I cannot clear a range on a hidden sheet. I have tried the following, but neither work unless I am on the sheet. With Sheets("Exchange Rates") .Range("B19", Range("B19").End(xlToRight)).ClearContents End With Sheets("Exchange Rates").Range("B19"...
  7. T

    Protecting cell ranges

    I have some cells with Formulae in and at times users need to use CLEAR to empty cell content but I dont want them to CLEAR cells with formulae in. Normal protection appears to lock the whole sheet and I just want to protect cell ranges.... Is there a way to do that?
  8. M

    VBA ClearContents changes formatting?

    OK for some reason while using a bunch of named ranges to clear out the data the borders get changed to the heavy border. So after a bunch of playing around with it I see that if I run the sub with nothing in the cells to clear it doesn't change any formatting. But I type something in the top...
  9. B

    VBA foreach or loop

    Hi, I use these forums a lot, but this is my first post. I have the following VBA in an excel sheet at the moment.... Sub Worksheet_Change(ByVal Target As Range) 'When D7 changes, I7 clears, and K7, M7, O7 all clear. If Target.Address(0, 0) = "D7" Then Range("I7, K7, M7...
  10. R

    VBA to Filter a value & Clear cells.

    I have a column which named as "Logic" wherein i need to filter the below 2 values from the said column and clear only the contents of the cell. > 0 >00-01-1900 0:00:00 The major challenge is, i am not able to clear the cells of incorrect date format from the above point. Please assist.
  11. H

    Clear Cell Based on Another Cell Value

    Im trying to Clear a value in "A3:A120" in sheet named (CSA1) if the value of Cell L2 in Sheet named (RESULTS) = "YES". I found the following Solution that Will only clear the cells if the YES is in cell L2 in CSA1 Sheet and tired to use to to pull the YES from the RESULTS SHEET: The Below is...
  12. D

    "Are You Sure?" Prompt on "Clear All" Button Press

    Hello, I would like Excel to prompt the user with this question, "Are You Sure" when selecting the 'Clear All' button on my form. Here's what my code looks like now: Macros Name = ClearYNH Sub ClearYNH() ' ' ClearYNH Macro ' '...
  13. D

    Deleting a post

    How can I delete one of my posts? I don't see an edit button so not clear how to either edit or delete. Thanks!
  14. W

    Clear non-contiguous cells

    Hi all, I want to clear a dynamic range of non-contiguous cells. The code I'm using (or trying to use :() is: Dim sht1 As Worksheet Dim LastRowWS1 As Long Dim nRange As Range Set sht1 = Sheets("Data") LastRowWS1 = sht1.Cells.Find("*", searchorder:=xlByRows...
  15. D

    Clear range, exclude headers

    I'm trying to clear contents of a range of cells, A2-C100 but excluding headers (so technically A2-A100, B2-B100 and C2-C100). How can I do this without specifying range for every column? So far I had this: Range("A2:A100").ClearContents Range("B2:B100").ClearContents...
  16. R

    2 Macro on 1 button

    Hello, new to VBA. I have created a Record Macro to delete some formatting on my spreadsheet. It works fine with the button. I have had users use the clear button by accident... I want to have a message box appear with "are you sure you want to clear" MsgBox "Ok to clear the schedule?"...
  17. ironsides

    General Question

    I posted a question this past March and got relies that solved my question which was ------------------------------------------------------------------------------------- Macro to clear data and fill starts cell B19 search col B and clear rows of all data and fill below the last row that has...
  18. Y

    How Can I Clear The Recent save as pinned folder Lists With VBA excel

    Hi my excel version is 2016 and I want to clear save as pinned folder list with VBA , I try this code: Sub ClearRecentFiles() Dim rf As RecentFile For Each rf In Application.RecentFiles rf.Delete Next 'rf End Sub but it only clear recent file list and not folder list could you please help me...
  19. P

    How To clear cell if cell another cell has "No.

    Hi hope you can help, I have a cell X2 where you have a dropdown box with yes or no, if no is selected I want this to clear the cell in U2, how do this can you help me please? I am still fairly new to this and still learning.
  20. L

    Clear all cells (cells.clear)

    Hi to clear all cells I can write this code Sub clearall() Cells.Clear End Sub I used object browser and found that cells is a property of 3 objects Application.Cells Range.Cells WorkSheet.Cells So my question, which one I am using when I say Cells. Clear? Thank you

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top