gostaria de unir tb estas macros:
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveSheet.Shapes("Sao Paulo").Select
'Selection.ShapeRange.PictureFormat.TransparentBackground = True
Selection.ShapeRange.PictureFormat.ColorType = msoPictureWatermark
Selection.ShapeRange.PictureFormat.Brightness = 0.5
'Selection.ShapeRange.Fill.BackColor.RGB = RGB(255, 45, 50)
'.ShapeRange.repaint.ForeColor.RGB = RGB(255, 45, 50)
End Sub
Sub Escala_Color()
'declara variaveis
Dim NLinhas As Integer, x As Integer
NLinhas = Application.WorksheetFunction.CountA(Sheets(1).Range("A:A")) - 1 'conta a quantidade de linhas preenchidas,
'menos total geral
'calcula dados
Application.Calculate
'loop: para cada linha, iniciando de 2:
For x = 2 To NLinhas
With Sheets(1).Shapes(Sheets(1).Range("A" & x))
.Fill.ForeColor.RGB = RGB(Color_to_RGB(Sheets(1).Range("D" & x).Value, "R"), _
Color_to_RGB(Sheets(1).Range("D" & x).Value, "G"), _
Color_to_RGB(Sheets(1).Range("D" & x).Value, "B"))
End With
Next x
End Sub
Function Ret_RGB_Cell(Celula As Range)
Ret_RGB_Cell = Celula.Interior.Color
End Function
Function Color_to_RGB(Color As Long, RGB As String)
Select Case RGB
Case "R"
Color_to_RGB = Color Mod 256
Case "G"
Color_to_RGB = (Color 256) Mod 256
Case "B"
Color_to_RGB = (Color 256 256) Mod 256
End Select
End Function
2° macro
Sub teste()
'
' teste Macro
'
'
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=Ret_RGB_Cell(RC[-1])"
Range("Q3").Select
ActiveCell.FormulaR1C1 = "=Ret_RGB_Cell(RC[-1])"
Range("Q4").Select
ActiveCell.FormulaR1C1 = "=Ret_RGB_Cell(RC[-1])"
Range("Q5").Select
End Sub
Como devo fazer?
Postado : 26/01/2018 1:40 pm