- Code: Select all
Dim workbook As Workbook = New Workbook
workbook.Version = ExcelVersion.Version2007
workbook.LoadFromFile(("sample.xlsx"))
Dim sheet As Worksheet = workbook.Worksheets(0)
If sheet.Range("B1").Text.StartsWith("AI") Then
sheet.Range("A1").Text = "January"
ElseIf sheet.Range("B1").Text.StartsWith("A") Then
sheet.Range("A1").Text = "February"
ElseIf sheet.Range("B1").Text.StartsWith("B") Then
sheet.Range("A1").Text = "March"
ElseIf sheet.Range("B1").Text.StartsWith("OR") Then
sheet.Range("A1").Text = "April"
ElseIf sheet.Range("B1").Text.StartsWith("QT") Then
sheet.Range("A1").Text = "May"
ElseIf sheet.Range("B1").Text.StartsWith("C") Then
sheet.Range("A1").Text = "June"
ElseIf sheet.Range("B1").Text.StartsWith("Q") Then
sheet.Range("A1").Text = "July"
Else
sheet.Range("A1").Text = "NOT EXIST"
End If