Solved

Change "," with "." in MSHFlexGrid1 vb6

Posted on 2011-02-24
2
692 Views
Last Modified: 2012-05-11
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
Comment
Question by:Wilder1626
2 Comments
 
LVL 14

Accepted Solution

by:
VBClassicGuy earned 500 total points
ID: 34969837
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
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 34969935
Thanks for your help.

This is perfect.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now