ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Help "Range" (https://www.excelbanter.com/excel-programming/368130-need-help-range.html)

mikespeck[_2_]

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



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com