Hey
I’m about to make a macro that transfer a Range of data from Sheet1 to Sheet2 in the excel. The transfer should take place for each row if a requirement is met.
More specific if the data on Sheet1 is for example:
Staff hours
Consulting hours
Driving
Test
Staff hours
In the macro it only supposed to send the data associated with Staff hours.
I have a macro that works but only if it is with one cell and not with the whole Range:
Sub Identificer()
Dim text As String
text = Range("A1").Value
If text = "Staff hours" Then result = Worksheets("Sheet2").Range("I1")
Range("B1").Value = result
End Sub
It don’t work if you write:
Sub Identificer()
Dim text As String
text = Range("A1:A2").Value
If text = "Personaletimer" Then result = Worksheets("Ark2").Range("I1:I2")
Range("B1:B2").Value = result
End Sub
I think maybe there should be another data before sub.
Can somebody help me?
I’m about to make a macro that transfer a Range of data from Sheet1 to Sheet2 in the excel. The transfer should take place for each row if a requirement is met.
More specific if the data on Sheet1 is for example:
Staff hours
Consulting hours
Driving
Test
Staff hours
In the macro it only supposed to send the data associated with Staff hours.
I have a macro that works but only if it is with one cell and not with the whole Range:
Sub Identificer()
Dim text As String
text = Range("A1").Value
If text = "Staff hours" Then result = Worksheets("Sheet2").Range("I1")
Range("B1").Value = result
End Sub
It don’t work if you write:
Sub Identificer()
Dim text As String
text = Range("A1:A2").Value
If text = "Personaletimer" Then result = Worksheets("Ark2").Range("I1:I2")
Range("B1:B2").Value = result
End Sub
I think maybe there should be another data before sub.
Can somebody help me?