Excel: Get Value from Sheet 1 to Sheet 2
Closed
BashirYazbik
Posts
58
Registration date
Monday 9 November 2015
Status
Member
Last seen
6 December 2015
-
17 Nov 2015 à 22:33
BashirYazbik Posts 58 Registration date Monday 9 November 2015 Status Member Last seen 6 December 2015 - 19 Nov 2015 à 23:13
BashirYazbik Posts 58 Registration date Monday 9 November 2015 Status Member Last seen 6 December 2015 - 19 Nov 2015 à 23:13
Related:
- Sheet2
- Excel mod apk for pc - Download - Spreadsheets
- Vat calculation excel - Guide
- Kernel for excel repair - Download - Backup and recovery
- Arrow keys not working in excel - Guide
- Excel clear formatting - Guide
3 responses
vcoolio
Posts
1411
Registration date
Thursday 24 July 2014
Status
Contributor
Last seen
6 September 2024
262
18 Nov 2015 à 02:13
18 Nov 2015 à 02:13
Hello Bashir,
Modify the code slightly as follows:-
As far as I can tell, your original code is trying to transfer the formulae also (hence the error as the code doesn't say anything about transferring the formulae) whereas you only need the values transferred to sheet 2, hence PasteSpecial xlPasteValues.
You also need to disable Events at the begining of the code and then enable them again at the end of the code ( as I've done above for you).
I hope that this helps.
Cheerio,
vcoolio.
Modify the code slightly as follows:-
Private Sub Worksheet_Activate()
Application.EnableEvents = False
Sheets("Sheet1").Range("A6:F6").Copy
Sheets("Sheet2").Range("A1").PasteSpecial xlPasteValues
Application.EnableEvents = True
Application.CutCopyMode = False
End Sub
As far as I can tell, your original code is trying to transfer the formulae also (hence the error as the code doesn't say anything about transferring the formulae) whereas you only need the values transferred to sheet 2, hence PasteSpecial xlPasteValues.
You also need to disable Events at the begining of the code and then enable them again at the end of the code ( as I've done above for you).
I hope that this helps.
Cheerio,
vcoolio.
vcoolio
Posts
1411
Registration date
Thursday 24 July 2014
Status
Contributor
Last seen
6 September 2024
262
19 Nov 2015 à 00:24
19 Nov 2015 à 00:24
Hello Bashir,
You're welcome. Glad that I could help.
@RayH:-
Thanks Ray. Good idea. I forgot about by-passing the clipboard.
Cheerio Gentlemen.
vcoolio.
You're welcome. Glad that I could help.
@RayH:-
Thanks Ray. Good idea. I forgot about by-passing the clipboard.
Cheerio Gentlemen.
vcoolio.
BashirYazbik
Posts
58
Registration date
Monday 9 November 2015
Status
Member
Last seen
6 December 2015
14
19 Nov 2015 à 23:13
19 Nov 2015 à 23:13
I still have one issue please.
The YELLOW part shown in the picture is the values got from sheet 1.
Every time the YELLOW part is updated, I need the GREEN part to be auto updated and keep adding down the row for the whole month. Please see picture.

I inserted the following code in VBA --> sheet 2:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Dim goout As Boolean
goout = False
xrow = 1
Set KeyCells = Range("A1:F1")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
xcolumn = Range(Target.Address).Column
Do
If Cells(xrow, xcolumn + 10).Value = "" Then
Cells(xrow, xcolumn + 10).Value = Cells(1, xcolumn).Value
goout = True
Else
xrow = xrow + 1
End If
Loop Until goout = True
End If
End Sub
If I update the YELLOW part manually, it will work fine and the GREEN part will auto update.
If I assign the code to an APPLY BUTTON in Sheet 1, the YELLOW part update but the GREEN part do not.
Thank you again for your help.
The YELLOW part shown in the picture is the values got from sheet 1.
Every time the YELLOW part is updated, I need the GREEN part to be auto updated and keep adding down the row for the whole month. Please see picture.

I inserted the following code in VBA --> sheet 2:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Dim goout As Boolean
goout = False
xrow = 1
Set KeyCells = Range("A1:F1")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
xcolumn = Range(Target.Address).Column
Do
If Cells(xrow, xcolumn + 10).Value = "" Then
Cells(xrow, xcolumn + 10).Value = Cells(1, xcolumn).Value
goout = True
Else
xrow = xrow + 1
End If
Loop Until goout = True
End If
End Sub
If I update the YELLOW part manually, it will work fine and the GREEN part will auto update.
If I assign the code to an APPLY BUTTON in Sheet 1, the YELLOW part update but the GREEN part do not.
Thank you again for your help.

18 Nov 2015 à 08:15
This work great for me. Thank you so much for the solution and the explanation.
Much appreciated.
18 Nov 2015 à 15:01
Sheets("Sheet2").Range("A1:F1") = Sheets("Sheet1").Range("A6:F6").Value19 Nov 2015 à 08:19
Thank you so much.