Thread: Grouping values
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Barbara Barbara is offline
external usenet poster
 
Posts: 97
Default Grouping values

Thank you so much! It works just as I wanted...

Have a nice day.
Barbara

PS:I love these Discussion Groups... They are so helpfull.

"Norman Jones" wrote:

Hi Barbara,

'----------------
Now..... Is there a way to change this:
Else
Espessura = 0

with this:
Else
Espessura = "Others"


I tryed but as it is text, it gives me an error!
'----------------

Try declaring Espessura as variant:

'=============
Public Sub Espessuras()
Dim Esp As Double 'Thickness article
Dim Espessura As Variant 'Regroup thickness
Dim linhaf As Long
Dim linha As Long
linhaf = Range("A1").End(xlDown).Row

For linha = 2 To linhaf
Esp = Range("P" & linha).Value
If Esp = "0.03" Then
Espessura = "0.03"
ElseIf Esp = "0.02" Then
Espessura = "0.02"
ElseIf Esp = "0.01" Then
Espessura = "0.01"
Else
Espessura = "Other"
End If
Range("Q" & linha).Value = Espessura
Next linha
End Sub
'<<=============


---
Regards,
Norman