Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MOre excel 4 macro problems


Below is the code I am trying to exicute.

Range(Cells(6, ActiveCell.Column), Cells(325
ActiveCell.Column)).Select
Selection.Copy
Sheets("Master Inventory").Activate
Range("G3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlSubtract
SkipBlanks _
:=False, Transpose:=False
Range("O1").Select
Sheets("Sales History").Select
Range("H3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlAdd
SkipBlanks:= _
False, Transpose:=False
Range("A3").Select
Sheets("Trucks").Select
Range("A9").Select
Application.CutCopyMode = False

I get error message indicating a problem with "range("g3").select

any suggestions?

Thank

--
~~ Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default MOre excel 4 macro problems

I get error message indicating a problem with "range("g3").select<<

Wouldn't it be nice if you gave us a hint about what problem was indicated
by the error message? Or better still, the textof the message?

It's hard to conceive of that line causing a problem unless xlNoSelection
protection is at work,

--

Vasant

"brwilson" wrote in message
...

Below is the code I am trying to exicute.

Range(Cells(6, ActiveCell.Column), Cells(325,
ActiveCell.Column)).Select
Selection.Copy
Sheets("Master Inventory").Activate
Range("G3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlSubtract,
SkipBlanks _
:=False, Transpose:=False
Range("O1").Select
Sheets("Sales History").Select
Range("H3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False
Range("A3").Select
Sheets("Trucks").Select
Range("A9").Select
Application.CutCopyMode = False

I get error message indicating a problem with "range("g3").select

any suggestions?

Thanks


---
~~ Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MOre excel 4 macro problems

I guess I should have expanded. The error message comes back as
runtime error 1004, select method of range class failed. I should als
mention that this works as a macro but not as VB code imbedded in
command button

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default MOre excel 4 macro problems

when put in a command button all unqualified references like

Range("G3").Select

are interpreted to refer to the sheet with the command button. Your intent
is to select on Master Inventory, so that is your problem. Master Inventory
is the active sheet but the code says to select on the sheet with the code -
but you can not select on the sheet with the code because it is not the
activesheet. If you want to use your code as written, move it to a general
module and call it from the CommandButton click event. In a general module
it will work as you expect it to. Otherwise, you would need to fully qualify
all range references to include the sheet.

--
Regards,
Tom Ogilvy

"brwilson" wrote in message
...

Below is the code I am trying to exicute.

Range(Cells(6, ActiveCell.Column), Cells(325,
ActiveCell.Column)).Select
Selection.Copy
Sheets("Master Inventory").Activate
Range("G3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlSubtract,
SkipBlanks _
:=False, Transpose:=False
Range("O1").Select
Sheets("Sales History").Select
Range("H3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False
Range("A3").Select
Sheets("Trucks").Select
Range("A9").Select
Application.CutCopyMode = False

I get error message indicating a problem with "range("g3").select

any suggestions?

Thanks


---
~~ Message posted from http://www.ExcelForum.com/



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
Excel Macro Warning problems Roy[_2_] Excel Discussion (Misc queries) 16 April 10th 10 07:37 PM
Excel Macro Warning problems Roy[_2_] Excel Discussion (Misc queries) 1 March 29th 10 05:45 AM
Excel Macro Warning problems Roy[_2_] Excel Discussion (Misc queries) 0 March 29th 10 01:17 AM
Excel Macro loop problems mibsaweiss Excel Discussion (Misc queries) 0 March 16th 06 04:45 PM
Workbook_Open macro created in Excel 97 problems on MAC Dick Kusleika Excel Programming 2 September 8th 03 06:42 PM


All times are GMT +1. The time now is 02:57 AM.

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

About Us

"It's about Microsoft Excel"