Automatticly copy values only

miicker

Board Regular
Joined
Jun 1, 2014
Messages
75
Hello everyone,

I have a question, how can I automaticly Copy values from A1:A50 to B1:B50 (values only)

So I have a form like this:

A1 (2-1)
A2 (3-1)
etc..

And I want:
B1 1
B2 2
etc..

So I can hide column A and users will not see any formula.

Kind regards,
Miicker
 
You have the option under cell formatting protection to hide the formulas.
 
Upvote 0
Yeah I know, but I try to use the data in conditional formatting, so hiding the formula does not work, when I use that cell as source for conditional formatting I get an error, So I would like to automatticly copy the values of the cells.
 
Upvote 0
So A1 has the formula =2-1?
What is the conditional formatting you are using for this cell?
 
Upvote 0
no its just a example, there is a IF and VLOOKUP in the cell A1, but I just want to copy the values only to B1, and when A1 changes, I want the value only data of B1 to change automatticly, is this possible?
 
Upvote 0
You could use ....copy>>Edit>>Paste Special>>Values only
but it won't change when A1 does !!
 
Upvote 0
You can try this.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim tRange As Range
Set tRange = Range(ActiveCell.Address)

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False

Range("A1:A150").Copy
Range("B1:B150").PasteSpecial Paste:=xlPasteValues
tRange.Offset(1, 0).Select


Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True




End Sub

Instructions for Installing Worksheet Code
1) Make sure the sheet you want to use this code on is active.
2) Right click the tab and choose view code.
3) Paste the code where the cursor is flashing.
4) Close the window.
5) Save the workbook.
6) The code will run when the event the code was written for is triggered.
 
Upvote 0
Maybe this then
Paste it into the Sheet Module
Code:
Private Sub Worksheet_calculate()
Columns("A:A").Copy
Columns("B:B").PasteSpecial Paste:=xlPasteValues
Columns("A:A").Hidden = True
End Sub

But it's simply a case of unhiding column"A" to see the formulae
 
Upvote 0
You can try this.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim tRange As Range
Set tRange = Range(ActiveCell.Address)

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False

Range("A1:A150").Copy
Range("B1:B150").PasteSpecial Paste:=xlPasteValues
tRange.Offset(1, 0).Select


Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True




End Sub

Instructions for Installing Worksheet Code
1) Make sure the sheet you want to use this code on is active.
2) Right click the tab and choose view code.
3) Paste the code where the cursor is flashing.
4) Close the window.
5) Save the workbook.
6) The code will run when the event the code was written for is triggered.


Thank you, this is exactly what I needed.
 
Upvote 0

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