I'm trying to learn VBA on my own so I'm doing to some basic stuff to mess around with it. What I'm trying to do right now is to look for the word "Total" inside of column A and after it finds the word consider the value on the next column then using the If then statement to judge if the number on column B is > then 1 then type on C1 "yes" or B1 "No"
Sub try5()
Set cell = Columns("A:A").Select
Selection.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(columnOffset:=1).Activate.Select
If cell > 1 Then
Range("C1").Value = "yes"
Else
Range("C1").Value = "no"
End If
End Sub
The first part of code, if I run it by it self works but VBA gives me a popup saying: "object required" while if I run with the IF THEN statement it says "Type mismatch".
Sorry if this is noob question.
Aucun commentaire:
Enregistrer un commentaire