macro to take messup text and turn it into numbers?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
hi everyone,

The code below works great, but it copies everything, i just want it to copy values
any ideas what bit i need to change?

thanks

Tony

the code:

VBA Code:
Sub AllReports()


    Dim fPath As String
    Dim wb As Workbook, data As Worksheet, raw As Worksheet, rng As Range, cel As Range, C8 As Range
    Set data = Sheets("Data Inputs")
    Set C8 = data.Range("C8")
    Set raw = Sheets("Raw Data")

    Set rng = raw.Range("C8:C" & LrowA)

'create folder if required
    fPath = ThisWorkbook.Path & "\All Reports"
    If Dir(fPath, vbDirectory) = "" Then MkDir fPath
    fPath = fPath & "\"
   
'save each workbook
    If Application.Wait(Now + TimeValue("0:00:02")) Then
    Application.StatusBar = "Creating new workbooks"
        For Each cel In rng
            cel.Resize(, 69).Copy C8 ''I think this is the part that should be values only?
            DoEvents
            ThisWorkbook.SaveCopyAs fPath & C8 & ".xlsm"
        Next
    End If
    Application.StatusBar = False
'open each workbook and delete sheet Raw Data
    For Each cel In rng
        Application.ScreenUpdating = False
        Application.StatusBar = "Deleting Raw Data in " & fPath & cel
        Set wb = Workbooks.Open(fPath & cel & ".xlsm")
        DoEvents
        Application.DisplayAlerts = False
        wb.Sheets("Raw Data").Delete
        Application.DisplayAlerts = True
        wb.Close (True)
        DoEvents
    Next cel
    

    
    MsgBox "done", , ""
    Application.StatusBar = False
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Change
VBA Code:
cel.Resize(, 69).Copy C8
To
VBA Code:
cel.Resize(, 69).Copy 
C8.PasteSpecial xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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