I have some code that scans an xls file source and, based on the company name, extracts sales information specific to that firm and inserts it into the company's own file.
I want to have a condition that only returns a value in one of my columns if a condition is met, even though it probably isn't very beautiful.
It is the line in the code below that has a comment: Any assistance is much valued.
For i = 2 To LastRow
If SourceSheet.Cells(i, 21).Value Like "CompanyName goes here*" Then
'change the column numbers to the relevant number
Product = SourceSheet.Cells(i, 11).Value
Base Sales Value = SourceSheet.Cells(i, 27).Value
Partner = SourceSheet.Cells(i, 21).Value
EndUser = SourceSheet.Cells(i, 7).Value
License = SourceSheet.Cells(i, 13).Value
PostingMonth = SourceSheet.Cells(i, 3).Value
LicType = SourceSheet.Cells(i, 12).Value
newuplift = SourceSheet.Cells(i, 15).Value
UpliftValue = SourceSheet.Cells(i, 28).Value
erow = DestSheet.Cells(DestSheet.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'change the column numbers to the relevant number
DestSheet.Cells(erow, 1).Value = ProdType
DestSheet.Cells(erow, 2).Value = License
DestSheet.Cells(erow, 3).Value = Partner
DestSheet.Cells(erow, 4).Value = EndUser
DestSheet.Cells(erow, 5).Value = SOValue
DestSheet.Cells(erow, 6).Value = PostingMonth
DestSheet.Cells(erow, 7).Value = newuplift
DestSheet.Cells(erow, 8).Value = LicType
DestSheet.Cells(erow, 9).Value = UpliftValue 'TRYING TO PLACE A CONDITION HERE - SEE BELOW
' If newuplift = "Renewal" then place the Upliftvalue in row 9, otherwise set to "0"
End If
Next i