MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 13th, 2002, 10:12 AM   #1
rdeters
New Member
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 40
Default

Firstly, I would like to say that your website is excellent. I have had some pretty detailed questions, but you were able to figure them out, cuddo's.
I have the following macro:

Sub Copying()
'
' Copying Macro
' Macro recorded 5/12/2002 by DETER
'

'
ActiveWindow.SmallScroll ToRight:=-1
Sheets("Working Database").Select
ActiveWindow.SmallScroll ToRight:=2
ActiveWindow.ScrollColumn = 1
Range("A1:G5250").Select
Selection.Copy
Sheets("IO Database").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

This macro works fine. What I want to do is hide the actual worksheet named "Working Database", with protection. But when I do this, and run the macro, it indicates a run time error becuase it can not find the worksheet. What do I need to change in the macro above for it to work on the hidden sheet?
Any help would be appreciative.
rdeters is offline   Reply With Quote
Old May 13th, 2002, 10:28 AM   #2
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Hi
I did not test this...
If the sheet is protected, you may need to unprotect it first...



Sub Copying()
'
' Copying Macro
' Macro recorded 5/12/2002 by DETER
'

'
ActiveWindow.SmallScroll ToRight:=-1
Sheets("Working Database").Visible = xlVisible
Sheets("Working Database").Select
ActiveWindow.SmallScroll ToRight:=2
ActiveWindow.ScrollColumn = 1
Range("A1:G5250").Select
Selection.Copy
Sheets("IO Database").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Working Database").Visible = xlHidden
End Sub



Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 10:40 AM   #3
rdeters
New Member
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 40
Default

I tried that macro and no luck. I get an error message that states:
"Run-time error '1004'", any other suggestions?
rdeters is offline   Reply With Quote
Old May 13th, 2002, 11:01 AM   #4
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Hi rdeters:
The problem is that your attempting to select a hidden sheet. You can still copy and paste from hidden sheets you just can't select them. Starting with a macro is an excellent idea but what you need to do after that is go in and refine your code.
For example I've take you piece of code for selecting the copy area and refined it so that you don't have to select the sheet. Another reason you will want to refine your code is so that you don't have to watch you sheets jumping all over the place... instead the end result seems to magically appear.
Macro Code
Code:
Public Sub SelectFirst()
Sheets("Working Database").Select
Range("A1:G5").Select
Selection.Copy
end sub
Macro Code after fine tuning
Code:
Public Sub CopyWhileHidden()
Sheets("Working Database").Range("A1:G5").Copy
End Sub
I think you should be able to see the pattern here. All i'm doing is replacing the word select with what's on the next line.
You may want to go into your excel-vb help and do a search for RangeSelection Property to read up on this.

[ This Message was edited by: Nimrod on 2002-05-13 10:08 ]
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 11:11 AM   #5
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

I gave you the wrong constant...
Still learning the object model here...

Change:

Sheets("Working Database").Visible = xlVisible

To:

Sheets("Working Database").Visible = xlSheetVisible

and

Change:

Sheets("Working Database").Visible = xlHidden

To:

Sheets("Working Database").Visible = xlSheetHidden

Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 11:21 AM   #6
rdeters
New Member
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 40
Default

Thanks for the help guys, both versions help me out enourmously, thanks.
rdeters is offline   Reply With Quote
Old May 13th, 2002, 11:26 AM   #7
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Following the concept that I discussed in my last posting here is your macro ..."fine tuned".. see the method ?
Code:
Sub Copying()
' Copying Macro
' Macro recorded 5/12/2002 by DETER
Sheets("Working Database").Range("A1:G5250").Copy
Sheets("IO Datbase").Range("A1:G5250").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 11:30 AM   #8
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Nimrod
I didn't mean to post on top of you. I was too busy trying to figure out why I kept getting an error...
Thanks for the tip. I did not know you could work with a hidden sheet.
Maybe you wouldn't mind explaining the difference between Hidden and VeryHidden?
Thanks,
Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 12:11 PM   #9
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

I'm sorry but I don't understand what you mean by " "Post on top". Is there a posting Etiquette that I'm not aware of ? If so please let me know as I don't want to offend anyone.
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 12:14 PM   #10
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

I don't use the very hidden but what I understand is the when a sheet is very hidden it cannot be unhidden through the menu. That to unhide a very hidden you must do it thru a macro. Is that your understanding ?
__________________

<MARQUEE>...........Never be afraid to try something new. Remember, amateurs built the ark, professionals built the Titanic...............The easiest thing to find is fault, don't be easy !.. --Anonymous--...</marquee>
Nimrod is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT -4. The time now is 07:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes