Text from specific row in one sheet appears in same row in active sheet when typing in cells

perola.rike

Board Regular
Joined
Nov 10, 2011
Messages
151
I have a strange bug (?) in my workbook. When I change a cell in the active sheet, doesn't matter what cell, the content from row 5 in another sheet appears in row 5 in the active sheet.
The text on the active sheet dissapears when I scroll down on the worksheet and up again, It is not placed physically in the cell. It happens almost all the time.
On the pictures attached - text from sheet Rapport row 5 appears on sheet Testprofil row 5, 1st column (Norwegian).

I really have no idea where to look for a solution to make this text stop appearing. Any help are really appreciated!


This is a macroactivated workbook. I only have one sheet with a workbook_change code, on the sheet Questionnaires:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "G1" Then
Application.ScreenUpdating = False
Range(Columns("J"), Columns(Columns.Count)).EntireColumn.Hidden = True
Dim c As Range

For Each c In Range("J4:XX4").Cells
On Error Resume Next
If c.Value = Range("G1") Then
c.EntireColumn.Hidden = False

End If
Next c
Application.ScreenUpdating = True
End If
End Sub
 

Attachments

  • pix 1.png
    pix 1.png
    55.4 KB · Views: 4
  • pix 2.png
    pix 2.png
    35 KB · Views: 4

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
1,836
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Please check don't have Workbook change sheet event or Not?
At the VBA window , Right click on thisworkbook and View Code?
if Not
Please upload your example file & Desired Results with XL2BB ADDIN (Preferable) OR upload it at free uploading site e.g. www.dropbox.com or googledrive or onedrive and insert link here.
 

perola.rike

Board Regular
Joined
Nov 10, 2011
Messages
151
I have tracked down the code that causes the problem. This code is part of a larger VBA code that creates a word document from the Workbook,. This specific code, export_profile, inserts a picture of a table in the word document.

However, why this specific code causes the problem as described above, I don't know. Any input on this would really be appreciated.


VBA Code:
Sub export_profile ()
    Sheets("profile").Range("H4:AY28").Copy
    Application.ScreenUpdating = False
    Sheets("JPG").Visible = xlSheetVisible
    Sheets("JPG").Select
    Range("B6").Select
    ActiveSheet.Pictures.Paste(Link:=True).Cut
    Sheets("JPG").Visible = xlSheetVeryHidden
    Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:

perola.rike

Board Regular
Joined
Nov 10, 2011
Messages
151
Specifically - this line of code causes the problem:

VBA Code:
ActiveSheet.Pictures.Paste(Link:=True).Cut
 
Last edited by a moderator:

perola.rike

Board Regular
Joined
Nov 10, 2011
Messages
151
Specifically - this line of code causes the problem:

VBA Code:
ActiveSheet.Pictures.Paste(Link:=True).Cut
I do not know why, but when I inserted this...

VBA Code:
Call Sheets("profile").Range("H4:AY28").CopyPicture(xlScreen, xlPicture)

...instead of the code below - the problem was solved!

VBA Code:
Sub export_profile ()
Sheets("profile").Range("H4:AY28").Copy
Application.ScreenUpdating = False
Sheets("JPG").Visible = xlSheetVisible
Sheets("JPG").Select
Range("B6").Select
ActiveSheet.Pictures.Paste(Link:=True).Cut
Sheets("JPG").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:
Solution

Watch MrExcel Video

Forum statistics

Threads
1,130,129
Messages
5,640,297
Members
417,135
Latest member
zeusmining

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
Top