I have wrote the following to look down column A until it finds a match with ‘FindDate’ (a named range that holds the date I wish to find). It then pastes ‘InserThis’ (a named range with word I would like inserted). This is offset by 22 columns. It works fine if ‘InsertThis’ is only one cell.
Is it possible make ‘InsertThis’ a range or cells, so more than one cell is pasted when a match is found?
Sub TestInsertOne()
Dim ArrayResult As Range
Set ArrayResult = Range("InsertThis")
'Start from cell.
Range("A3").Select
'Set Do loop to stop when an empty cell is reached.
Do Until IsEmpty(ActiveCell)
'How many cells to concatenate and what range to equal.
If ActiveCell = Range("FindDate") Then
'Where to paste the result.
ActiveCell.Offset(0, 22) = ArrayResult
Else
End If
'Step down 1 row from present location.
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Is it possible make ‘InsertThis’ a range or cells, so more than one cell is pasted when a match is found?
Sub TestInsertOne()
Dim ArrayResult As Range
Set ArrayResult = Range("InsertThis")
'Start from cell.
Range("A3").Select
'Set Do loop to stop when an empty cell is reached.
Do Until IsEmpty(ActiveCell)
'How many cells to concatenate and what range to equal.
If ActiveCell = Range("FindDate") Then
'Where to paste the result.
ActiveCell.Offset(0, 22) = ArrayResult
Else
End If
'Step down 1 row from present location.
ActiveCell.Offset(1, 0).Select
Loop
End Sub