Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Macro in Excel


  • Please log in to reply

#1
DPCP

DPCP

    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).


Code:
Sub CallData()
'
' CallData Macro
'

'
	Sheets("Ignore-this-sheet").Select
	FinalRow = Range("A65536").End(xlUp).Row
	Range("A1:DP & FinalRow").Select
	Selection.Copy
	Windows("Master Template 2.xls").Activate
	Sheets("extracts").Select
	Rows("3:3").Select
	Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
		:=False, Transpose:=False
	
	Rows("3:3").Select
	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:

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


Any suggestions on how I could fix the problem??

Many thanks!!

DP
  • 0

Advertisements







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