Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Can someone help me with this VBA code. I want cells B3 through H3 to drop down only if the value of A3 is 1. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range(Target.Address), Me.Range("A3")) _ Is Nothing Then Me.Cells(Me.Range("A:A").Rows.Count, Target.Column).Clear Dim rgOldValues As Range Dim iLastRow As Long iLastRow = Me.Cells(Columns(Target.Column).Rows.Count, Target.Column) _ .End(xlUp).row Application.EnableEvents = False Select Case iLastRow Case 1 Case 2 Case 3 Range("A4:H4").Value = Range("A3:H3").Value Range("C4").Value = Now Cells(4, Target.Column).Value = Cells(3, Target.Column).Value Case Else vaOldValues = Me.Range("A4:H" & _ IIf(iLastRow = 4, 5, iLastRow)) Range("A5:H5").Resize(UBound(vaOldValues, 1), 6).Value = _ vaOldValues Range("A4:H4").Value = Range("A3:H3").Value Range("C4").Value = Now Set rgOldValues = Me.Range(Cells(Target.row + 2, Target.Column), _ Cells(iLastRow, Target.Column)) Cells(4, Target.Column).Value = Cells(3, Target.Column).Value End Select Application.EnableEvents = True End If End Sub -- mikespeck ------------------------------------------------------------------------ mikespeck's Profile: http://www.excelforum.com/member.php...o&userid=34946 View this thread: http://www.excelforum.com/showthread...hreadid=569508 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can someone help me put psuedo code into actual excel macro?? | Excel Discussion (Misc queries) | |||
VLookup Error in Part of a Named Range | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
t-distribution puzzle in Excel | Excel Discussion (Misc queries) | |||
Macro for changing text to Proper Case | Excel Worksheet Functions |