Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Pinging the hive
PostPosted: Wed Oct 21, 2009 13:42 
User avatar
EvilTrousers

Joined: 30th Mar, 2008
Posts: 3073
OK so it's probably 10 years since I did any proper VBA programming in Excel and that area of my brain has now been overwritten with which corners I need to drift on in Outrun 2.

So needs the helps.

I've got a spreadsheet which calculates the commission on sales for stuff and there's a separate sheet for a package deal which adds the component parts together. Currently when the package is complete it is meant to copy the existing sheet to a new one then clear the blank rows in the original and rename it for future reference.

My macro works all the way from here

Sheets.Add 'creates new sheet
Sheets("Sheet1").Move After:=Sheets(4) 're-organises tabs
Sheets("Package").Select 'selects Package sheet
sheetname = InputBox("Name for current Package?") 'asks user for existing package name
Sheets("Package").Name = sheetname 'renames the sheet according to above
Range("a1:o12").Select 'selects the range that contain the calcs
Selection.Copy ' copies them to the clipboard
Sheets("Sheet1").Select 'goes to the new sheet
ActiveSheet.Paste ' and pastes it in

Then when it gets to

Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select 'selects the cells that contain the variables

I get a 1004 run time error of the superbly vague 'application-defined or object-defined error.'

I get the same if I just pick a single cell for the range.

Why it no worky?

_________________
Everyone but Zardoz is better than me at videogames.


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:03 
User avatar

Joined: 31st Mar, 2008
Posts: 925
I ran though it roughly on my machine and it worked so I'm not sure. Will
Code:
Sheets("Sheet1").Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select
work?


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:05 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69725
Location: Your Mum
Bluecup wrote:
I ran though it roughly on my machine and it worked so I'm not sure. Will
Code:
Sheets("Sheet1").Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select
work?

It shoudln't, there's nothing wrong with A2:L11.

Try
Code:
Sheets("Sheet1").Range("A2", "L11").Select


And give it capital letters, just in case.
If not, try
Code:
Sheets("Sheet1").Range(Cells(2,1), Cells(11,12)).Select

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:07 
User avatar
EvilTrousers

Joined: 30th Mar, 2008
Posts: 3073
Bluecup wrote:
I ran though it roughly on my machine and it worked so I'm not sure. Will
Code:
Sheets("Sheet1").Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select
work?


It only fucking well does.

Thanks bloody heaps.

_________________
Everyone but Zardoz is better than me at videogames.


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:07 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69725
Location: Your Mum
Fucking VBA. Could have been the capitals.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:09 
User avatar
Pyrotechnician!!!1

Joined: 13th Jul, 2009
Posts: 3357
Location: Stockport
Trousers wrote:
Bluecup wrote:
I ran though it roughly on my machine and it worked so I'm not sure. Will
Code:
Sheets("Sheet1").Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select
work?


It only fucking well does.

Thanks bloody heaps.

YEAH, IN YOUR FACE GRIM...!!!!!!111!!11

_________________
Image

WARNING!!! DO NOT CLICK THIS UNLESS YOU CAN HANDLE THE SIGHT OF MAXIMUM PWNAGE!!!


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:11 
User avatar

Joined: 31st Mar, 2008
Posts: 925
Trousers wrote:
Bluecup wrote:
I ran though it roughly on my machine and it worked so I'm not sure. Will
Code:
Sheets("Sheet1").Range("A2:A11,C2:C11,D2:D11,F2:F11,H2:H11,L2:L11").Select
work?


It only fucking well does.

Thanks bloody heaps.


Cool. No idea why your original code didn't work though because it went though fine on mine. Took a guess really.


Top
 Profile  
 
 Post subject: Re: Pinging the hive
PostPosted: Wed Oct 21, 2009 14:21 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10174
It hates you (it's number 78 on the Outrun 2 leaderboard).


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Columbo, GazChap, Majestic-12 [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.