excel - Compile error: Expected: = -


i got error when implementing sub tabpaint within sub datediff

public sub tabpaint(ss integer, cc integer)   sheets(ss).tab       .color = cc       .tintandshade = 0   end end sub   public sub datediff(date1 string, date2 string, shn integer)     if datediff("d", date1, date2, vbmonday, vbfirstjan1) < 0         tabpaint (shn, 255)     else         tabpaint(shn,5287936)     end if end sub 

in vba, if aren't assigning return value of function anything, or if method subroutine, leave out parenthesis, try this:

public sub tabpaint(ss integer, cc integer)   sheets(ss).tab       .color = cc       .tintandshade = 0   end end sub   public sub datediff(date1 string, date2 string, shn integer)     if datediff("d", date1, date2, vbmonday, vbfirstjan1) < 0         tabpaint shn, 255     else         tabpaint shn, 5287936     end if end sub 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -