Help with VBA scipt

Jrambo75

New Member
Joined
Apr 24, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I found this thread and it was spot on for what I needed. However, I'm using the script below for adding notes for invoices that are then pulled into a PowerPivot, but it hangs on Pivot refresh if I put more than one note per invoice number (I'm using the invoice number as a relation between two tables). Any suggestions?


1587766160470.png




1587766223590.png



Sub Clear()

Application.ScreenUpdating = False

Dim NextRow As Range
Set NextRow = Sheets("notes").Range("A19").End(xlUp).Offset(1, 0)
Sheets("Aging").Range("e2:g2").Copy
NextRow.PasteSpecial (xlValues)

Dim NextRow2 As Range

Sheets("Aging").Range("e2:g2").ClearContents


Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
When you say it hangs on Pivot refresh, does excel still appear to work (but the data in the Pivot table doesn't refresh)? I ask, because the likely culprit is probably the line:

Application.ScreenUpdating = False

You could try commenting the line out (by putting an apostrophe ' at the start of the line and see if that helps...?
 
Upvote 0
Hey Dan,

I tried your suggestion but it is still giving me the same message. It has to do with the one to many relationships in the tables:

1587995744789.png
 
Upvote 0
I think the solution is to replace the old "note" with the most recent. Any help with that code would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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