Forum Discussion
doit_2729
May 29, 2022Copper Contributor
Copy and paste row data based on cell value with date criteria
I have the situation where i would like to copy data based on cell value in Column 1 where the row data should be copy row 13 to the below log for the respectively date to track our ripening log. ...
- May 29, 2022
Here you go:
Private Sub CommandButton1_Click() Dim r As Long On Error Resume Next r = Evaluate("MATCH(1,(A16:A1000=""4A"")*(B16:B1000=TODAY()),0)") On Error GoTo 0 If r = 0 Then MsgBox "Combination of Room 4A and today's date not found" Else Range("C" & r + 15).Resize(1, 13).Value = Range("C13").Resize(1, 13).Value End If End Sub Private Sub CommandButton2_Click() Dim r As Long On Error Resume Next r = Evaluate("MATCH(1,(A16:A1000=""4B"")*(B16:B1000=TODAY()),0)") On Error GoTo 0 If r = 0 Then MsgBox "Combination of Room 4B and today's date not found" Else Range("C" & r + 15).Resize(1, 13).Value = Range("C14").Resize(1, 13).Value End If End Sub
HansVogelaar
May 29, 2022MVP
Here you go:
Private Sub CommandButton1_Click()
Dim r As Long
On Error Resume Next
r = Evaluate("MATCH(1,(A16:A1000=""4A"")*(B16:B1000=TODAY()),0)")
On Error GoTo 0
If r = 0 Then
MsgBox "Combination of Room 4A and today's date not found"
Else
Range("C" & r + 15).Resize(1, 13).Value = Range("C13").Resize(1, 13).Value
End If
End Sub
Private Sub CommandButton2_Click()
Dim r As Long
On Error Resume Next
r = Evaluate("MATCH(1,(A16:A1000=""4B"")*(B16:B1000=TODAY()),0)")
On Error GoTo 0
If r = 0 Then
MsgBox "Combination of Room 4B and today's date not found"
Else
Range("C" & r + 15).Resize(1, 13).Value = Range("C14").Resize(1, 13).Value
End If
End Sub
- doit_2729Jun 01, 2022Copper ContributorHi Hans,
You are life saver for me!
It working fine for me.
This is great help to me.
Thanks a lot.
Much appreciated for the you time.
God bless you,.