mercredi 20 mai 2015

Fixing the Block If without End If error

I am just getting started with Macros and VB but have some experience with Excel formulas. My problem is my excel formulas are becoming very long and complicated and I thought VB could help me.

I have a lot of financial data that I would like to categorize in a column. My first step is to categorize particular companies as either a private company or a warrant. I get a 'block if without end if' error with the below code. I have tried various things but no luck. Any help to a VB newbie would be much appreciated.

If Range("A2:A400") = "Company A" Then Range("F2:F400") = "Private Company" Else If Range("A2:A400") = "Company B" Then Range("F2:F400") = "Private Company" Else If Range("A2:A400") = "Company C" Then Range("F2:F400") = "Private Company" Else If Range("A2:A400") = "Company D" Then Range("F2:F400") = "Warrant" Else If Range("A2:A400") = "Company E" Then Range("F2:F400") = "Warrant" Else If Range("A2:A400") = "Company F" Then Range("F2:F400") = "Warrant" End If

End Sub

Aucun commentaire:

Enregistrer un commentaire