Full Numbers in CSV

vikas_newports

Board Regular
Joined
May 26, 2016
Messages
121
Office Version
  1. 365
Platform
  1. Windows
I generated a CSV file from data and the problem is that the numbers are showing as in the picture while when I click on it they are the full number in the formula bar
I want to show ful in cell too . I am doing from VBA so please guide me
How can I do it

Screenshot_1.jpg
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
try
VBA Code:
Range(Cells(1, 1), Cells(6, 1)).NumberFormat = "0"

at the end of your primary code. Change the range to suit your needs.
 
Upvote 0
I am generating this csv from other file , I dont thing it is much helpful without actual file

VBA Code:
Sub SMS()
    Dim a, b() As String, i As Long, ii As Long, n As Long, txt As String
    Dim Last_Row1 As Long
    Dim Find1 As String
    Dim k1 As String
    Dim Find2 As String
    Dim k2 As String
    Dim Find3 As String
    Dim k3 As String
    Dim Find4 As String
    Dim k4 As String
    Dim Find5 As String
    Dim k5 As String
    Dim Find6 As String
    Dim k6 As String
    Dim Rng As Range
    
    
    With Sheets("salaries")
        With .Range("a1", .Cells.SpecialCells(11))
            a = Application.Index(.Value, Evaluate("row(1:" & .Rows.Count & ")"), _
                Array(1, 2, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 24, 25, 26, 27))
        End With
    End With
    ReDim b(1 To UBound(a, 1))
    For i = 4 To UBound(a, 1)
        If a(i, 1) Like "*.*" Then
            n = n + 1
            txt = Join(Array(a(i, 2), a(i, 3)), ",") & ","
            txt = txt & Split(a(i, 1), ".")(1) & " your salary for " & _
            LCase$(Format$(Date, "mmm.yy")) & " is Basic " & a(i, 4)
            For ii = 5 To UBound(a, 2)
                If a(i, ii) <> "" Then txt = txt & " " & a(3, ii) & " " & a(i, ii)
            Next
            b(n) = txt
        End If
    Next
    If n > 0 Then
        ReDim Preserve b(1 To n)
        Open ThisWorkbook.Path & "\SMS_Salaries.csv" For Output As #1
            Print #1, Join(b, vbCrLf)
        Close #1
    End If
    
' Reopen CSV for Modification "" in Start end C column and Negative for Deductions
    Workbooks.Open ThisWorkbook.Path & "\SMS_Salaries.csv"

 Find1 = "TAX 0"
 k1 = ""
 Columns("C").Replace what:=Find1, replacement:=k1, lookat:=xlPart, MatchCase:=False
 
 Find2 = "Pension 0"
 k2 = ""
 Columns("C").Replace what:=Find2, replacement:=k2, lookat:=xlPart, MatchCase:=False
 
 Find3 = "ADV. 0"
 k3 = ""
 Columns("C").Replace what:=Find3, replacement:=k3, lookat:=xlPart, MatchCase:=False
 
 Find4 = "Sacco 0"
 k4 = ""
 Columns("C").Replace what:=Find4, replacement:=k4, lookat:=xlPart, MatchCase:=False
 
 Find5 = "ABS. 0"
 k5 = ""
 Columns("C").Replace what:=Find5, replacement:=k5, lookat:=xlPart, MatchCase:=False
 
  Find6 = "ABS. 0"
 k6 = ""
 Columns("C").Replace what:=Find6, replacement:=k6, lookat:=xlPart, MatchCase:=False
 
Set Rng = Range("C1:C" & Cells(Rows.Count, "A").End(xlUp).Row)
  With Rng.Offset(, 2)
    .Formula = "=" & String(4, Chr(34)) & "&C1&" & String(4, Chr(34))
    .Value = .Value
  End With
     Range("E:E").Copy Range("C:C")
    Columns("D:E").Delete

    Range("A1:A10000").Select
    Selection.NumberFormat = "0"


    ActiveWorkbook.Save
    ActiveWorkbook.Close
    
End Sub
 
Upvote 0
If i m not wrong, you are trying to format all numbers in column B (Phone).
November_ Salaries 2020 Sample Rock.xlsx
ABC
1PAY DATE:PhoneBank Account
2
3EmployeeName
4
5
6
7
8M.Mleme2.65885E+1110111122
9M.Chilinkhwambe2.65885E+11458749652
10A.Chapuma2.65882E+111780208
11W.Namasipa2.65889E+1154215558
12G.Kajanga2.66E+11100000
13H.Najira2.66E+11001
Salaries

I changed the format to general just to check.

if so, then try
VBA Code:
sheets("salaries").Range(Cells(8, 2), Cells(13, 2)).NumberFormat = "0"
.

where your rows start at 8 of column B and ends at row 13 of column B.

HTH
 
Upvote 0
Fadee, I am generating a csv from this sheet (salaries) and now I am trying to format the number in generated csv
somehow I am very begineer in vba so I am unable to do it in the process of generating csv so I am try to do it on generated csv
 
Upvote 0

Forum statistics

Threads
1,215,700
Messages
6,126,285
Members
449,308
Latest member
VerifiedBleachersAttendee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top