Hello
I have a problem in Visual basic with Numberformat.
I have a large matrix (schedule) in excel with diverent names (random text of MAX 3 initials /cell) when I click with the Right moussebutton on the activecell I wants that the content (text) of the activecell confert to NUMBER format.
Exemple: when I click (procedure Worksheet_BeforeRightClick) on activecell "ABC" I want the letters "ABC" as numberformat so when I fill in afterwards a number ( for exemple number one ) I see "ABC" in the activecell but number one in the formulabalk
Module that doesn't work:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim cel As String
cel = ActiveCell.Value
If ActiveCell.Value <> "" And ActiveCell.Value <> 1 Then
ActiveCell.NumberFormat = cel
ActiveCell.Value = 1
Cancel = True
End If
End Sub
Many Thanks
Johan
I have a problem in Visual basic with Numberformat.
I have a large matrix (schedule) in excel with diverent names (random text of MAX 3 initials /cell) when I click with the Right moussebutton on the activecell I wants that the content (text) of the activecell confert to NUMBER format.
Exemple: when I click (procedure Worksheet_BeforeRightClick) on activecell "ABC" I want the letters "ABC" as numberformat so when I fill in afterwards a number ( for exemple number one ) I see "ABC" in the activecell but number one in the formulabalk
Module that doesn't work:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim cel As String
cel = ActiveCell.Value
If ActiveCell.Value <> "" And ActiveCell.Value <> 1 Then
ActiveCell.NumberFormat = cel
ActiveCell.Value = 1
Cancel = True
End If
End Sub
Many Thanks
Johan