Solved

Change "," with "." in MSHFlexGrid1 vb6

Posted on 2011-02-24
2
697 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 6 hours left to enroll

627 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