HELP Macro no longer working!!

Itried

New Member
Joined
Jul 27, 2015
Messages
22
Today i tried running my macro and it is no longer working. It was working fine on Friday but it is giving me the wrong results now. I didn't change anything and I cant figure out why it is pulling the wrong data.

Here is my code which I think looks fine

Sub database()


Application.StatusBar = "It's Working..Relax."
On Error GoTo lblError
Dim bEvents As Boolean, iCalc As Integer, bScrnUpd As Boolean
bEvents = Application.EnableEvents
iCalc = Application.Calculation
bScrnUpd = Application.ScreenUpdating
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False


Dim rng As Range
Dim wbA As Workbook, wbB As Workbook


Set wbA = ThisWorkbook
Set wbB = Workbooks.Open("Z:\snv_pfm_commdrive\Sprint PFM\Mir Ali\Macro Enabled File\Sprint Database.xlsx")


With Sheets(4)
Set rng = Union(.Range("$J:$J"), .Range("$Q:$Q"), .Range("$AS:$AS"))
rng.Copy wbA.Sheets(3).Range("$B1")

wbB.Close


Sheets(3).Select


Call ConcatDB


Application.EnableEvents = bEvents
Application.Calculation = iCalc
Application.ScreenUpdating = bScrnUpd
Application.StatusBar = False
Exit Sub


'reset them even if you are exiting due to error
lblError:
Application.EnableEvents = bEvents
Application.Calculation = iCalc
Application.ScreenUpdating = bScrnUpd
Debug.Print Err.Description



End With


End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I'm not sure how to post images but I could post a picture of the results to show you. It is not even pulling in the entire columns just a few cells of >180 and 0's
 
Upvote 0
Perhaps it will help if you actually describe what you think the code should be doing.
 
Upvote 0
I found out the problem. The issue was that somebody accidentally updated the workbook that the macro pulls from and added an extra tab. So it was pulling weird info from the wrong tab. I just panicked in the moment and didn't thoroughly look at what was happening.
 
Upvote 0

Forum statistics

Threads
1,215,450
Messages
6,124,912
Members
449,195
Latest member
Stevenciu

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