ou used range instead of target for your select but I would write it like this Or even simpler by ‘dim AType As Range ‘set AType = Range("S8:AL8") If Not Intersect(Target,range(“s8:al8”) is nothing then
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim SAType As Range Set SAType = Range("S8:AL8") If Not Intersect(Target, SAType) Is Nothing Then On Error Resume Next Select Case LCase(Target)' Case "amount" Target.Offset(1, 0).Resize(296).Style = "Comma" Case "percent" Target.Offset(1, 0).Resize(266).NumberFormat = "0.000000%" End Select End If End Sub Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Tiffany Sent: Thursday, March 29, 2012 9:52 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Problem with Format Change Upon Data Validation Change Event Hi - I'm a little new to VBA but have managed to put together a macro that half achieves its intended purpose. Depending on what is chosen in a data validation cell (any cell in range S8 to AL8), the macro is supposed to change the format of 296 cells below the data validation cell: a.. If "Amount" is chosen in the data validation cell, the format in cells below should change to "Comma" style (i.e., 0.00). This works. b.. If "Percent" is chosen in the data validation cell, the format in cells below should change to "0.000000%". This doesn't work. I'm stumped since the language looks right to me and no debugging error pops up. Any ideas? The macro I have now is copied below. Any help you could provide would be greatly appreciated. Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim SAType As Range Set SAType = Range("S8:AL8") If Not Application.Intersect(Target, SAType) Is Nothing Then On Error Resume Next Select Case SAType Case "Amount" Target.Offset(1, 0).Range("A1:A296").Style = "Comma" Case "Percent" Target.Offset(1, 0).Range("A1:A296").NumberFormat = "0.000000%" End Select End If End Sub -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com