G
Guest
Hi,
I have a vba lines to set the right format depending the case value
Everything work fine. However I must click in a cell to make the change.
What I do is:
I select from a dropdown menu the option and this automaticly change the
value and set the format for the numbers. The number change but not the
format until I click on the sheet. Do you have a way to refresh without
clicking?
For your info.
This code is in the sheet (Right click, code,etc)
Thank you everyone.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim C As String
Select Case Range("D15").Text
Case "$"
C = "$#,##0"
Case "%"
C = "0.0%"
Case "#"
C = "#,##0"
Case "$C"
C = "$ #,##0.00"
Case "#C"
C = "##.0"
Case "T"
C = "###.##"
Case Else
C = "General"
End Select
ActiveSheet.Unprotec
Range("D1735,G17:G35,J17:J35,M17:M35,P1735,S17:S35,V17:V35,Y17:Y35,AB17:AB35,AE17:AE35,AH17:AH35,AK17:AK35,AN17:AN35").NumberFormat = C
Range("A11").Value = "Click Here"
Range("A10").Select
ActiveSheet.Protect
End Sub
I have a vba lines to set the right format depending the case value
Everything work fine. However I must click in a cell to make the change.
What I do is:
I select from a dropdown menu the option and this automaticly change the
value and set the format for the numbers. The number change but not the
format until I click on the sheet. Do you have a way to refresh without
clicking?
For your info.
This code is in the sheet (Right click, code,etc)
Thank you everyone.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim C As String
Select Case Range("D15").Text
Case "$"
C = "$#,##0"
Case "%"
C = "0.0%"
Case "#"
C = "#,##0"
Case "$C"
C = "$ #,##0.00"
Case "#C"
C = "##.0"
Case "T"
C = "###.##"
Case Else
C = "General"
End Select
ActiveSheet.Unprotec
Range("D1735,G17:G35,J17:J35,M17:M35,P1735,S17:S35,V17:V35,Y17:Y35,AB17:AB35,AE17:AE35,AH17:AH35,AK17:AK35,AN17:AN35").NumberFormat = C
Range("A11").Value = "Click Here"
Range("A10").Select
ActiveSheet.Protect
End Sub