S
ste mac
Hi, I am a bit stuck on the macro below.
If I put the 'Dataunits' range on the same sheet as the
countif "DataInput")it works fine, but I cannot get it to
look for the data on the other sheet... any ideas...
? is the syntax wrong for the data range?
Cheers...
ste
Sub DataCount()
Dim xlrow As Long
Dataunits = Sheets("TheData").Range("DF3:AF10000")
Sheets("DataInput").Select
xlrow = 152
Do While Not (ActiveSheet.Cells(xlrow, 13).Value = "")
'Collate all data
ActiveSheet.Cells(xlrow, 16).Formula = "=countif(" & Dataunits & ", " &
ActiveSheet.Cells(xlrow, 13).Value & ")"
'Change formula to values
ActiveSheet.Cells(xlrow, 16).Value = ActiveSheet.Cells(xlrow, 16).Value
xlrow = xlrow + 1
Loop
End Sub
If I put the 'Dataunits' range on the same sheet as the
countif "DataInput")it works fine, but I cannot get it to
look for the data on the other sheet... any ideas...
? is the syntax wrong for the data range?
Cheers...
ste
Sub DataCount()
Dim xlrow As Long
Dataunits = Sheets("TheData").Range("DF3:AF10000")
Sheets("DataInput").Select
xlrow = 152
Do While Not (ActiveSheet.Cells(xlrow, 13).Value = "")
'Collate all data
ActiveSheet.Cells(xlrow, 16).Formula = "=countif(" & Dataunits & ", " &
ActiveSheet.Cells(xlrow, 13).Value & ")"
'Change formula to values
ActiveSheet.Cells(xlrow, 16).Value = ActiveSheet.Cells(xlrow, 16).Value
xlrow = xlrow + 1
Loop
End Sub