I have the following macro written which follows the purpose of what I want it to do:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Range("a2").Select
Dim rng As Range
If Target.Count > 1 Then Exit Sub
Set rng = Range("A1")
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Value = 1 Then
Application.GoTo Sheet2.Range("b1:r1")
Selection.Copy
Sheets("Sheet1").Select
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
End If
End Sub
I have a formula in cell A1 which does the following:
=IF(ISERROR(IF(VLOOKUP($E$1,$K$4:$K$5,1,0)=$E$1,1,"")),"",IF(VLOOKUP($E$1,$K$4:$K$5,1,0)=$E$1,1,""))
However even with calculations on I have to go into this cell and select the formulae and hit return for it to run the macro.
I wondered if there was a way I could either write this into the macro:
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(IF(VLOOKUP(R1C5,R4C11:R5C11,1,0)=R1C5,1,"""")),"""",IF(VLOOKUP(R1C5,R4C11:R5C11,1,0)=R1C5,1,""""))"
Range("A2").Select
or if this was even possible?
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Range("a2").Select
Dim rng As Range
If Target.Count > 1 Then Exit Sub
Set rng = Range("A1")
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Value = 1 Then
Application.GoTo Sheet2.Range("b1:r1")
Selection.Copy
Sheets("Sheet1").Select
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
End If
End Sub
I have a formula in cell A1 which does the following:
=IF(ISERROR(IF(VLOOKUP($E$1,$K$4:$K$5,1,0)=$E$1,1,"")),"",IF(VLOOKUP($E$1,$K$4:$K$5,1,0)=$E$1,1,""))
However even with calculations on I have to go into this cell and select the formulae and hit return for it to run the macro.
I wondered if there was a way I could either write this into the macro:
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(IF(VLOOKUP(R1C5,R4C11:R5C11,1,0)=R1C5,1,"""")),"""",IF(VLOOKUP(R1C5,R4C11:R5C11,1,0)=R1C5,1,""""))"
Range("A2").Select
or if this was even possible?