PDA

View Full Version : if there is text add conditional format and edges



niklasbp
01-29-2015, 11:27 AM
Hi there

i cannot figure out how to make this macro

what my sheet looks like:




(A1)Navn
(B1)Emner
TP indeks
PPO indeks
Index
Total
Rang


name1
515
131
94
113
146
1




i Want a rightedge from A1 to the last name in Column A, but this is variable from sheet to sheet
Same goes for E and F

Also i am trying to get a conditional format that makes the column B light green or .Color = -16752384, if the cell is above 300 and also only goes down to last name in column A
Also same column light red or .Color = 13561798 if below 300
and columns C:F same problem just with above 99,99 is green and below is red

I rly hope you can help me =)!

ValerieT
02-02-2015, 08:56 AM
This would give you for sure your last name for A (coded not to consider row 1 which is probably headers)



For i = 2 To 9999999
If Cells(i, 1) = 0 Then
EndLine = i - 1
Exit For
End If
next i


then you loop or range based on endline and do whatever you want. Example for B

For i = 2 to Endline
If cells (i,2) > 300 then
cells (i,2).Interior.Color = 16752384
else
cells (i,2).Interior.Color = 13561798
endif
next i