Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help "Range"
I've got this formula. It currently accepts data comeing from an OPC server int A3, Whenever that changes the data drops down one cell along with the date and time which is in B4. My question is I want cells d4 through L4 to drop down whenever A3 does. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range(Target.Address), Me.Range("A3:B3")) _ 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").Value = Range("A3").Value Range("B4").Value = Now Cells(4, Target.Column).Value = Cells(3, Target.Column).Value Case Else vaOldValues = Me.Range("A4:B" & _ IIf(iLastRow = 4, 5, iLastRow)) Range("A5:B5").Resize(UBound(vaOldValues, 1), 2).Value = _ vaOldValues Range("A4:B4").Value = Range("A3:B3").Value Range("B4").Value = Now Set rgOldValues = Me.Range(Cells(Target.Row + 6, 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=564272 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" | Excel Programming | |||
"Subscript out of range" error for: Workbooks("Test1.xls").Save | Excel Programming | |||
Using "Cells" to write "Range("A:A,H:H").Select" | Excel Programming |