Format as number

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
I know to format a cell as a number it should look something along these lines:

Code:
Columns("D:K").Select
Selection.NumberFormat = "#.00"

I have the following, and would like values in E:K of copied values to format as number in the following section.

Code:
WS1.Range(WS1.Cells(c.Row, "E"), WS1.Cells(c.Row, "K")).Copy
WS2.Cells(lr2, "E").PasteSpecial Paste:=xlPasteValues

Code:
Function Copy()


Dim WS1 As Worksheet, WS2 As Worksheet, lr1 As Long, lr2 As Long, c As Range
Application.ScreenUpdating = False
Set WS1 = Worksheets("ABR")
Set WS2 = ActiveSheet



lr1 = WS1.Cells(Rows.Count, "M").End(xlUp).Row
lr2 = 8
For Each c In WS1.Range("M1:M" & lr1)
    If c.Value = "Not Exported" Then
        WS1.Range(WS1.Cells(c.Row, "A"), WS1.Cells(c.Row, "C")).Copy
        WS2.Cells(lr2, "B").PasteSpecial Paste:=xlPasteValues
        
        
        WS1.Range(WS1.Cells(c.Row, "E"), WS1.Cells(c.Row, "K")).Copy
        WS2.Cells(lr2, "E").PasteSpecial Paste:=xlPasteValues
        
        lr2 = WS2.Cells(WS2.Rows.Count, "B").End(xlUp).Row + 1
        c.Value = "Exported"
    End If
Next c




Application.ScreenUpdating = True
Application.CutCopyMode = False
End Function
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Code:
WS1.Range(WS1.Cells(c.Row, "E"), WS1.Cells(c.Row, "K")).Copy
WS2.Cells(lr2, "E").PasteSpecial Paste[COLOR=inherit][FONT=Monaco]:[/FONT][/COLOR][COLOR=inherit][FONT=Monaco][B]=[/B][/FONT][/COLOR][COLOR=inherit][FONT=Monaco]xlPasteValuesAndNumberFormats[/FONT][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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