Copy data from one sheet to another change formatting

robrobet

New Member
Joined
Jun 3, 2013
Messages
27
Office Version
  1. 365
  2. 2019
Hi,

here is what I trying to do,
example I have sheet 1 with data, I have formula in X1 which read the value in A1.
I copy the data from sheet 1, X1 to Sheet 2 A 1(Paste Value only)
Sheet 2 I have VLOOKUP formula and doesn't work because the value I post in A1

When I click A1 cells, it show little !mark, if I click the option convert to number my vlookup function work.
I like to have macro which convert all of the data to number.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try first code for Non-Decimal Numbers & Second For Decimal Numbers
VBA Code:
Sub Pasting()
Sheet2.Range("A1", Sheet2.Range("A" & Rows.Count).End(xlUp)).Value = CLng(Sheet1.Range("X1", Sheet1.Range("X" & Rows.Count).End(xlUp)).Value)
End Sub
VBA Code:
Sub Pasting2()
Sheet2.Range("A1", Sheet2.Range("A" & Rows.Count).End(xlUp)).Value = CDbl(Sheet1.Range("X1", Sheet1.Range("X" & Rows.Count).End(xlUp)).Value)
End Sub
 
Upvote 0
Or try this:
VBA Code:
Sub Pasting()
Sheets("Sheet2").Range("A1:A" & Sheets("Sheet1").Range("X" & Rows.Count).End(xlUp).Row).Value = Sheets("Sheet1").Range("X1:X" & Sheets("Sheet1").Range("X" & Rows.Count).End(xlUp).Row).Value
End Sub
 
Upvote 0
Solution
You're Welcome & Thanks for Feedback.
 
Upvote 0

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

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