Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

macro debug error range

Forum home » Delegate support and help forum » Microsoft Excel Training and help » MACRO; DEBUG; ERROR; RANGE

MACRO; DEBUG; ERROR; RANGE

ResolvedVersion 365

Bryony has attended:
Excel Advanced course
Excel Power Query course

MACRO; DEBUG; ERROR; RANGE

I have created a macro to copy and paste a table from workbook A into workbook B.
I'd like it to
1) open workbook B
2) copy selection from workbook A
3) Paste in B as values

The code looks ok but I keep receiving 'Run-time error '9' Subscript out of range' error message.

I've removed a pw and files are macro enabled. Any ideas what might be prompting this error please?

Edited on Wed 8 Jun 2022, 15:05

RE: MACRO; DEBUG; ERROR; RANGE

Hi Bryony,

Thank you for the forum question.

When I run VBA courses I always advice the delegates to stay away from copy and paste using VBA. Copy and paste always give you problems. You should move the data not copy and paste.

I always use an array to do the job.

Sorry I will not be able to advice you, what gives you the error. It can be a lot of things.

If you paste your code here and tell me which line return the error I might be able to help you.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Wed 15 Jun 2022: Automatically marked as resolved.

Excel tip:

Generate randon numbers

Some types of analysis require you to use randomly generated numbers. You can also use randomly generated numbers to quickly populate an Excel spreadsheet. There's an easy function you can use to do this automatically. Here are a few of the ways you can use it:

Type =RAND() in a cell to generate a number between 0 and 1.
Type =RAND()*100 to generate a number between 1 and 100.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.