Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default commandbutton on workbook assistance

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default commandbutton on workbook assistance

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" wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default commandbutton on workbook assistance

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default commandbutton on workbook assistance

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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default commandbutton on workbook assistance

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Worksheet/Workbook via CommandButton WLMPilot Excel Programming 1 November 14th 06 11:37 PM
How do I create a new commandbutton in a new workbook? Sally Excel Programming 2 May 27th 06 04:13 PM
Commandbutton to Workbook Open Richard Excel Programming 6 February 28th 06 03:43 AM
Delete a Commandbutton from another Workbook jase[_2_] Excel Programming 5 June 3rd 05 03:15 PM
Close WorkBook with CommandButton Rockee052[_50_] Excel Programming 3 February 23rd 04 04:04 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"