Solved

slight tweak to previous solution

Posted on 2013-01-29
6
194 Views
Last Modified: 2013-02-04
In this previous solution: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27989319.html

When the above solution creates the duplicate rows for the name and the card number it changes the last digit of all the card numbers to 0 and the format of the cell to 'custom'. I need the card number to stay exactly the same and keep the format at 'text'.
0
Comment
Question by:JaseSt
  • 3
  • 3
6 Comments
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 38831890
ok here it is

For this you will need to apply the following solution.

1) Make a copy of your latest MC file and give it a new name.
2) open the file and DO NOT ACTIVATE MACROES.
3) You need now to locate All MCR sheets and HMF account and do the following:
for every sheet highlight the Card Number Column (Col D) click on the letter D so it highlight it all and right click choose Format Cell then on the Number Tab select Text and press OK. Do this for each and every sheet MCR and HMF account sheet.
4) Open VBA and doublleclick on module1 and click to view 1 sub at a time and delete the Sub SplitAmountsMCR
5) Paste the below code aftter any End Sub

Sub SplitAmountsMCR(WS As Worksheet, Target As Range)
Dim num, count, adjust, dateAdder As Integer
Dim startDate, LastDateinMC As Date
Dim colnum, rowNum, stopRow As Integer

If UCase(Left(Trim(WS.Name), 3)) = "MCR" Or UCase(Trim(WS.Name)) = "HMF ACCOUNT" Then
       
     If Not Intersect(Target, WS.Columns(5)) Is Nothing Then

     If UCase(Left(Trim(WS.Name), 3)) = "MCR" Then
        'Col E
         colnum = 5
         adjust = 4
         count = 0
         RowAdj = 1
     Else
        'Col I
         colnum = 9
         count = 1
         adjust = 0
         RowAdj = 0
     End If
      
         
        rowNum = Target.Row
        stopRow = Target.Row + Target.Rows.count
      
        '---> Fix Card number to be formated correctly.
        WS.Cells(rowNum + count, colnum - 5 + adjust).NumberFormat = "@"
        WS.Cells(rowNum, colnum - 5 + adjust).Value = Format(WS.Cells(rowNum, colnum - 5 + adjust).Value)
      
        'Do While rowNum < stopRow
              
        If WS.Cells(rowNum, colnum).Value > 0 Then
            num = WS.Cells(rowNum, colnum).Value
            Do While num > 2000
                Application.EnableEvents = False
                Cells(rowNum + count + RowAdj, colnum).EntireRow.Insert
                stopRow = stopRow + 1
                WS.Cells(rowNum + count, colnum + 1 + adjust).Value = 2000
                WS.Cells(rowNum + count, colnum - 7 + adjust).Value = WS.Cells(rowNum, colnum - 7 + adjust).Value
                WS.Cells(rowNum + count, colnum - 6 + adjust).Value = WS.Cells(rowNum, colnum - 6 + adjust).Value
                WS.Cells(rowNum + count, colnum - 5 + adjust).NumberFormat = "@"
                WS.Cells(rowNum + count, colnum - 5 + adjust).Value = Format(WS.Cells(rowNum, colnum - 5 + adjust).Value)
                Application.EnableEvents = True
                num = num - 2000
                count = count + 1
            Loop
            
            Application.EnableEvents = False
            'WS.Cells(rowNum + count + RowAdj, colnum).EntireRow.Insert
            stopRow = stopRow + 1
            WS.Cells(rowNum + count, colnum + 1 + adjust).Value = num
            WS.Cells(rowNum + count, colnum - 7 + adjust).Value = WS.Cells(rowNum, colnum - 7 + adjust).Value
            WS.Cells(rowNum + count, colnum - 6 + adjust).Value = WS.Cells(rowNum, colnum - 6 + adjust).Value
            WS.Cells(rowNum + count, colnum - 5 + adjust).NumberFormat = "@"
            WS.Cells(rowNum + count, colnum - 5 + adjust).Value = Format(WS.Cells(rowNum, colnum - 5 + adjust).Value)
            Application.EnableEvents = True
        End If
        rowNum = rowNum + 1
        'Loop
    End If
End If
End Sub

Open in new window



6) SAVE and Exit the workbook.
7) Open it and give it a try putting manually Card number then manually an amount in E for MCR sheets and see what it give you and also try importing an email.

Let me know
gowflow
0
 

Author Closing Comment

by:JaseSt
ID: 38838120
That did it! Thank you.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38840741
Tks your welcome. Pls let me know any other issue you may need help with.
gowflow
0
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.

 

Author Comment

by:JaseSt
ID: 38841222
oh, there is more, believe me. Thanks SO MUCH for your help. I'll post another here in the near future.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38841232
ok np
gowflow
0
 

Author Comment

by:JaseSt
ID: 38850946
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

708 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

16 Experts available now in Live!

Get 1:1 Help Now