LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default How to write a macro that will clear validated cells to blank?

I have a workbook which any user can come in and choose several options in
order to give a price to a customer. The problem is that some customer's
qualify for promotions for the pricing column (F) and the user needs to
select the promotion from a validated list of options for each cell
(F14-F22). I integrated a "reset button" that when pressed runs a macro to
clear the contents of column "B"... What should the VBA be in order to, at
the same time, change my F14-F22 lists back to their first choice (blank)
when the "reset button" is pressed? I pasted what I currently have which is
only clearing column B (I tried writing the F column macro which is below
"Next Acell"):

Private Sub cmdReset_Click()
Dim TotRows As Integer
Dim Acell As Range
Dim i As Integer
Dim SheetName As String
Dim NetRev As Double

SheetName = "New Customers"
TotRows = 28
i = 3
For Each Acell In Worksheets(SheetName).Range("B" & i & ":B" & TotRows)
'reset to nothing
Worksheets(SheetName).Range("B" & i).Value = 0
i = i + 1
Next Acell

SheetName = "New Customers"
For Each cell In Range("F14,F15,F16,F17,F18,F19,F20,F21,F22")

If cell.Validation.Type = x1ValidateList Then

cell.Value = Range(cell.Validation.Formula1).Cells(1, 1).Value
End If
Next cell
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear cells macro Dorothy Excel Discussion (Misc queries) 5 April 7th 08 12:46 AM
How to clear 'blank' cells CaroleO Excel Discussion (Misc queries) 2 March 2nd 07 02:56 PM
clear range of cells if another becomes blank bgg Excel Worksheet Functions 3 January 17th 07 11:32 PM
how do I write macro to sum numbers up to next blank line? Art Nittskoff Excel Discussion (Misc queries) 2 January 2nd 07 04:56 PM
macro to clear cells press313 Excel Discussion (Misc queries) 0 May 24th 06 02:31 AM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"