PC Review


Reply
Thread Tools Rate Thread

commandbutton on workbook assistance

 
 
=?Utf-8?B?bGF1Z2hpbmcgZ3Jhdnk=?=
Guest
Posts: n/a
 
      11th Jun 2007
Hi

I've dropped a commandbutton onto a work book. The button collects data from
that work book when clicked and opens a different workbook to apply the data
collected on to the new workbook. Alls good until I program a range/cell I
want the data dumped into when I get an error 1004 message. The program still
seems to be pointing at the first workbook. Any ideas how I get it to focus
on the new workbook?
 
Reply With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      11th Jun 2007
Hi Laughing Gravy,

Try posting your problematic code.

However, you can almost certainly resolve your
problem by explicitly qualifying your ranges.


---
Regards,
Norman

"laughing gravy" <(E-Mail Removed)> wrote in message
news:48A02814-F65D-43A8-8AE0-(E-Mail Removed)...
> Hi
>
> I've dropped a commandbutton onto a work book. The button collects data
> from
> that work book when clicked and opens a different workbook to apply the
> data
> collected on to the new workbook. Alls good until I program a range/cell I
> want the data dumped into when I get an error 1004 message. The program
> still
> seems to be pointing at the first workbook. Any ideas how I get it to
> focus
> on the new workbook?



 
Reply With Quote
 
=?Utf-8?B?UGZsdWdz?=
Guest
Posts: n/a
 
      11th Jun 2007
Try using workbook objects to make it easier to designate ranges. For
instance:

dim collectWB as Workbook, applyWB as Workbook
set collectWB = ThisWorkbook
'....collect data, etc
set applyWB = Workbooks.Open Filename:=(your file path here)

Then you can reference ranges using these workbook objects without having to
switch back and forth. For example, if you wanted to put the result into A1
on a sheet named "Total", you could use:

applyWB.sheets("Total").range("a1").value = result
'change this variable to work for you

Hope this helps.
Pflugs

"laughing gravy" wrote:

> Hi
>
> I've dropped a commandbutton onto a work book. The button collects data from
> that work book when clicked and opens a different workbook to apply the data
> collected on to the new workbook. Alls good until I program a range/cell I
> want the data dumped into when I get an error 1004 message. The program still
> seems to be pointing at the first workbook. Any ideas how I get it to focus
> on the new workbook?


"laughing gravy" wrote:

> Hi
>
> I've dropped a commandbutton onto a work book. The button collects data from
> that work book when clicked and opens a different workbook to apply the data
> collected on to the new workbook. Alls good until I program a range/cell I
> want the data dumped into when I get an error 1004 message. The program still
> seems to be pointing at the first workbook. Any ideas how I get it to focus
> on the new workbook?

 
Reply With Quote
 
=?Utf-8?B?bGF1Z2hpbmcgZ3Jhdnk=?=
Guest
Posts: n/a
 
      12th Jun 2007
aha. Your a star.

thks

"Pflugs" wrote:

> Try using workbook objects to make it easier to designate ranges. For
> instance:
>
> dim collectWB as Workbook, applyWB as Workbook
> set collectWB = ThisWorkbook
> '....collect data, etc
> set applyWB = Workbooks.Open Filename:=(your file path here)
>
> Then you can reference ranges using these workbook objects without having to
> switch back and forth. For example, if you wanted to put the result into A1
> on a sheet named "Total", you could use:
>
> applyWB.sheets("Total").range("a1").value = result
> 'change this variable to work for you
>
> Hope this helps.
> Pflugs
>
> "laughing gravy" wrote:
>
> > Hi
> >
> > I've dropped a commandbutton onto a work book. The button collects data from
> > that work book when clicked and opens a different workbook to apply the data
> > collected on to the new workbook. Alls good until I program a range/cell I
> > want the data dumped into when I get an error 1004 message. The program still
> > seems to be pointing at the first workbook. Any ideas how I get it to focus
> > on the new workbook?

>
> "laughing gravy" wrote:
>
> > Hi
> >
> > I've dropped a commandbutton onto a work book. The button collects data from
> > that work book when clicked and opens a different workbook to apply the data
> > collected on to the new workbook. Alls good until I program a range/cell I
> > want the data dumped into when I get an error 1004 message. The program still
> > seems to be pointing at the first workbook. Any ideas how I get it to focus
> > on the new workbook?

 
Reply With Quote
 
=?Utf-8?B?UGZsdWdz?=
Guest
Posts: n/a
 
      12th Jun 2007
No problem!

"laughing gravy" wrote:

> aha. Your a star.
>
> thks
>
> "Pflugs" wrote:
>
> > Try using workbook objects to make it easier to designate ranges. For
> > instance:
> >
> > dim collectWB as Workbook, applyWB as Workbook
> > set collectWB = ThisWorkbook
> > '....collect data, etc
> > set applyWB = Workbooks.Open Filename:=(your file path here)
> >
> > Then you can reference ranges using these workbook objects without having to
> > switch back and forth. For example, if you wanted to put the result into A1
> > on a sheet named "Total", you could use:
> >
> > applyWB.sheets("Total").range("a1").value = result
> > 'change this variable to work for you
> >
> > Hope this helps.
> > Pflugs
> >
> > "laughing gravy" wrote:
> >
> > > Hi
> > >
> > > I've dropped a commandbutton onto a work book. The button collects data from
> > > that work book when clicked and opens a different workbook to apply the data
> > > collected on to the new workbook. Alls good until I program a range/cell I
> > > want the data dumped into when I get an error 1004 message. The program still
> > > seems to be pointing at the first workbook. Any ideas how I get it to focus
> > > on the new workbook?

> >
> > "laughing gravy" wrote:
> >
> > > Hi
> > >
> > > I've dropped a commandbutton onto a work book. The button collects data from
> > > that work book when clicked and opens a different workbook to apply the data
> > > collected on to the new workbook. Alls good until I program a range/cell I
> > > want the data dumped into when I get an error 1004 message. The program still
> > > seems to be pointing at the first workbook. Any ideas how I get it to focus
> > > on the new workbook?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandButton to open a Excel workbook aussiegirlone Microsoft Excel Misc 2 25th Mar 2009 01:34 AM
How do I create a new commandbutton in a new workbook? =?Utf-8?B?U2FsbHk=?= Microsoft Excel Programming 2 27th May 2006 04:13 PM
Commandbutton to Workbook Open =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Programming 6 28th Feb 2006 03:43 AM
Delete a Commandbutton from another Workbook jase Microsoft Excel Programming 5 3rd Jun 2005 03:15 PM
Close WorkBook with CommandButton Rockee052 Microsoft Excel Programming 3 23rd Feb 2004 04:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:05 PM.