Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 699
  • Last Modified:

Change "," with "." in MSHFlexGrid1 vb6

Hello all,

In my code bellow, i apply a format to be "0.00". That, it work.

But what i want to add, it's this:

In the same column, search for comma ",", it there is one, put the cell in orange, and change it to a dot ".".

That, for all the MSHFlexGrid1.

How can i do that please?

Thanks again for your help.

Private Sub Command6_Click()
Dim i As Long

 
For i = 1 To MSHFlexGrid1.Rows - 1
        
        'Grids are 0 based so 0 means col1, 1 means col2, 3 means col2 and so on
        If MSHFlexGrid1.TextMatrix(i, 3) <> "" Then

            
            'Format
            
            MSHFlexGrid1.TextMatrix(i, 18) = Format(MSHFlexGrid1.TextMatrix(i, 18), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 19) = Format(MSHFlexGrid1.TextMatrix(i, 19), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 20) = Format(MSHFlexGrid1.TextMatrix(i, 20), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 21) = Format(MSHFlexGrid1.TextMatrix(i, 21), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 43) = Format(MSHFlexGrid1.TextMatrix(i, 43), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 46) = Format(MSHFlexGrid1.TextMatrix(i, 46), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 49) = Format(MSHFlexGrid1.TextMatrix(i, 49), "0.00")
            
            
        Else
            'break out of loop
            Exit For
        End If
    Next i
End Sub

Open in new window

0
Wilder1626
Asked:
Wilder1626
1 Solution
 
VBClassicGuyCommented:
In your

'Format

section, use:

txt = MSHFlexGrid1.TextMatrix(i, 3)

If Instr(txt,",") Then
   txt = Replace(txt, ",", ".")
   MSHFlexGrid1.TextMatrix(i, 3) = txt
   MSHFlexGrid1.Row = i
   MSHFlexGrid1.Col = 3
   MSHFlexGrid1.CellBackColor = &H80FF&
End If
0
 
Wilder1626Author Commented:
Thanks for your help.

This is perfect.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now