error in active chart - why?

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
Hi,
in sheet2 i have some cells which are update dynamically, and in sheet3 i have a chart which is updated by values that are in sheet2

everything works good if i'm on sheet2 (sheet2 active)

but if i click on sheet3 and i wait for the IF case i've got an error.
why?
local Variable
Sub macro1()
Dim pIndex As String
pIndex contains A after a while B and so on...
...
If WorksheetFunction.CountA(Sheets("Sheet2").Columns(pIndex)) > 1
I have no problem also if i'm in another sheet that is not a chart
 
Last edited:
I can reproduce your problem. It's behaving as if A1 is the ActiveCell/Target. Most strange.

This worked for me:

Code:
Sub Test()
    Dim wbTis As Workbook
    Dim myColCheck As Long
    Set wbTis = ThisWorkbook
    myColCheck = 42
    wbTis.Worksheets("sheet1").Range("F11:V11").Copy
    wbTis.Worksheets("sheet1").Range("F" & myColCheck).PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,213,543
Messages
6,114,240
Members
448,555
Latest member
RobertJones1986

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