No sir, it will be brought over from the For Sales tab when you hit the Copy Data button on the itmof tab.
No sir, it will be brought over from the For Sales tab when you hit the Copy Data button on the itmof tab.
Place this code in the worksheet module for Sheet("itbof")... not in Sheet("itmof"). When you click the 'Copy Data' button and then select Sheet("itbof"), your columns should automatically update.
![]()
Private Sub Worksheet_Activate() Dim bottomA As Integer bottomA = Range("A" & Rows.Count).End(xlUp).Row Dim bottomL As Integer bottomL = Range("L" & Rows.Count).End(xlUp).Row Dim rng1 As Range Dim rng2 As Range For Each rng1 In Sheets("itbof").Range("A2:A" & bottomA) If rng1 <> "" Then Cells(rng1.Row, 3).Value = "A" Cells(rng1.Row, 20).Value = "N" End If Next rng1 For Each rng2 In Sheets("itbof").Range("L2:L" & bottomL) If rng2 <> "" Then Cells(rng2.Row, 9).Value = Cells(rng2.Row, 12).Value * 1.08 End If Next rng2 End Sub
OK, I'll rephrase this, I did some more testing, and the only time it errors out is if I switch over to the itbof tab before I hit the copy data button, other than that it works great. To make it "dummy proof" is there any way to just make it run after I hit the itbof tab? This way it doesn't matter if we accidentally switch to that tab first before the copy data button is pressed...
Thanks, I appreciate everything you've done so far!
I would like to make a suggestion. First, remove the code from the worksheet module and put it into a regular module and change the name of the macro so that it's not a Worksheet_Activate event. Then you can run the macro by assigning it to a button on either worksheet or you can call the macro from your "Copy Data" macro. If you call it from the "Copy Data" macro, it will complete the "itbof" sheet automatically when it completes the "itmof" sheet. If you want to keep the two tasks separate, then assign it to a button. I hope that helps.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks