Friday, 15 May 2015

excel - Turn my text into any color in VBA for length longer than 5 characters -


If my LAN is large then I want to change my string to green. 5. Here is my code. Anyone can help me, I get this error:

The object does not support this property

 < Code> Sub Dame long as a samstink in the form of a string = 1 dim cc as I long term = worksheets ("Sheet 1"). Range ("C1") End (XL DOWN). For RO-1 = I = a lastrow cc = worksheets ("Sheet1"). Range ("C" & amp; i) if lane (cc) & gt; 5 Worksheets ("Sheet 1"). Character (CC, I) .Fault. Color = VBrade end if next I end all  

This will fail on this line:

  cc = worksheet ("sheet 1"). Category ("C" & amp; i)  <

Because range () gives a range and CC is a string.

This will fail on this line:

  worksheets ("Sheet1"). Character (CC, I) .Fault. Color = vbRed  

because character () takes only one parameter.

Try this one:

  Sub-Dame () as long as Demarro has dimmed as an integer for long I as long lastrow = Worksheet ("sheet 1"). Range ("C1") End (XL DOWN). For IFR1 I = 1 if line (worksheets ("Sheet 1") range ("C" & amp; i) .text). 5 Then lane for one = 5 (worksheets ("Sheet1"). Range ("C" & amp; i) .text) Worksheets ("Sheet 1"). Category ("C" & amp; i). Tractor (A). After this, note that this line:  
  worksheets ("Sheet 1"). Category ("C" & I). The Artwork (A) .Folt. Color = vbRed  

will set everyone, but first 5 characters red set your question to green So use vbGreen instead.

If you want to set the entire cell contents to green, change it:

 Lane (worksheets ("Sheet1") range for code (= 1). Range ("C" & amp; i) .text) Worksheets ("Sheet1"). Category ("C" & amp; i) Character (A) font <.  

No comments:

Post a Comment