I have Windows XP and running Excel 2010. Can someone of the collective show me how to programmatically write the following IF statement in VBA? On the internet and in this forum seen examples which use the amersand. No matter what I do I continue to get errors.
Dim LastRowInDatabase as Variant
Dim FirstRowInDatabase as Variant
'
LastRowInDatabase = 1294
FirstRowInDatabase = 2
'
For FirstRowInDatabase = FirstRowInDatabase To LastRowInDatabase Step 1
'
ActiveSheet.Cells(FirstRowInDatabase, 52).Select
'ActiveCell.FormulaR1C1 = "=IF(D2="","",COUNTIF($D$2:D2,D2))"
ActiveCell.FormulaR1C1 = "=IF(D2="","",COUNTIF($D$2:D2,D2))"
'
Next FirstRowInDatabase
Change From:
ActiveCell.FormulaR1C1 = "=IF(D2="","",COUNTIF($D$2:D2,D2))"
Change To:
ActiveCell.FormulaR1C1 = "=IF(D & "FirstRowInDatabase " = "","",COUNTIF($D$2:D & "FirstRowInDatabase",D & "FirstRowInDatabase"))"
Bookmarks