Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Macro in Excel

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 5 posts
Hi all

I have an Excel workbook which runs a few macros to collect data from some other Excel workbooks.

One of the macros basically is meant to select rows of data to copy over. What I have tried to do below is to select all rows that have data in (as some of the sheets from which the data is being copied from will have 1 row of data, others will have 3, etc etc).

Sub CallData()
' CallData Macro

	FinalRow = Range("A65536").End(xlUp).Row
	Range("A1:DP & FinalRow").Select
	Windows("Master Template 2.xls").Activate
	Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
		:=False, Transpose:=False
	Selection.Insert Shift:=xlDown
End Sub
But I get an error msg:

Run-time error '1004':

Method 'Range' of object '_Global' failed

and the debugger points to the line:

Range("A1:DO & FinalRow").Select

Any suggestions on how I could fix the problem??

Many thanks!!

  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP