A Misbehaving Macro

laingy24

New Member
Joined
Apr 19, 2015
Messages
2
I want the below macro to leave the user on cell A3 in the sheet "Crew Satisfaction Data" but for some reason it leaves the user on a different sheet ("Response Calculator") that isn't mentioned at all in the Macro.

Can anyone tell me why and how I can fix it?

Sub SORTING_DATA()
'
' SORTING_DATA Macro
'

'
Columns("C:C").Select
Selection.Copy
Application.CutCopyMode = False
Sheets("Tidied CS Data").Select
Columns("B:E").Select
Selection.ClearContents
Sheets("Raw CS Data").Select
Selection.Copy
Sheets("Tidied CS Data").Select
Range("B1").Select
ActiveSheet.Paste
Sheets("Raw CS Data").Select
Columns("F:G").Select
Application.CutCopyMode = False
Selection.Copy
Columns("F:H").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Tidied CS Data").Select
Range("C1").Select
ActiveSheet.Paste
Sheets("Crew Satisfaction Data").Select
Range("A3").Select
End Sub

Ewan :O)
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Your macro has lots of unqualified ranges. By that i mean they have no corresponding sheet to go with the range. That means excel will use the active sheet at the time the line executes. Which sheet is the active sheet when you start running the macro? I cant see any possible way that macro leaves you on any other cell than cell A3 of Crew Satisfaction Data sheet unless it doesnt complete. See if this does the same thing noting that each range has a corresponding sheet bar the last where we already know Crew Satisfaction Data is the active sheet:

Code:
Sheets("Raw CS Data").Columns("C:C").Copy Sheets("Tidied CS Data").Range("B1")
Sheets("Raw CS Data").Columns("F:H").Copy Sheets("Tidied CS Data").Range("C1")
Sheets("Crew Satisfaction Data").Select
Range("A3").Select
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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