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 Apr 10th, 2002, 01:50 AM   #1
friso
New Member
 
Join Date: Apr 2002
Posts: 25
Default

Hello,

Ik have a relative long Macro that needs to be executed when a userform is displayed.

First i put the macro code outside the userform, the macro therefore was only executed when the userform was closed.

After this i put the exact same code in the userform. But now all i get to see is a white userform and excel crashing on it

any one knows how you should do these two tasks simultaniously?

my code:

Sub mysub1()

Consolform.Show
ButtonInfra_Click
Consolform.ConsolLabel2.Caption = "l"
ButtonProducts_Click
Consolform.ConsolLabel2.Caption = "ll"
ButtonProcesses_Click
Consolform.ConsolLabel2.Caption = "lll"
ButtonEA_Click
Consolform.ConsolLabel2.Caption = "llll"
ButtonCIB_Click
Consolform.ConsolLabel2.Caption = "llll"
ButtonRM_Click
Consolform.ConsolLabel2.Caption = "lllll"

End Sub

This didn't work at all, next i put the code inside the userform this caused excel to crash.

Thanks for helping out.

friso is offline   Reply With Quote
Old Apr 10th, 2002, 02:01 AM   #2
Qroozn
Board Regular
 
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
Default

how do i set a msgbox to read as a list..eg
a
b
c
d
e

instead of a b c d e

is it vbleft or something?

i keep going blank
Qroozn is offline   Reply With Quote
Old Apr 10th, 2002, 02:03 AM   #3
Qroozn
Board Regular
 
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
Default

oops. soory about that FRISCO
Qroozn is offline   Reply With Quote
Old Apr 10th, 2002, 03:00 AM   #4
Colo
MrExcel MVP
 
Colo's Avatar
 
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
Default

Hi friso. You need to divide the code as following.
Please try.


'--- into a standard module--from here-
Sub mysub1()
Consolform.Show
End Sub
'--- to here ---------------------------

'--- into a Consolform module--from here-
Private Sub ButtonInfra_Click()
Call PvtMysub("l")
End Sub

Private Sub ButtonProducts_Click()
Call PvtMysub("ll")
End Sub

Private Sub ButtonProcesses_Click()
Call PvtMysub("lll")
End Sub

Private Sub ButtonEA_Click()
Call PvtMysub("llll")
End Sub

Private Sub ButtonCIB_Click()
Call PvtMysub("llll")
End Sub

Private Sub ButtonRM_Click()
Call PvtMysub("lllll")
End Sub

Private Sub PvtMysub(strCaption As String)
ConsolLabel2.Caption = strCaption
End Sub
'--- to here ---------------------------
Colo is offline   Reply With Quote
Old Apr 10th, 2002, 03:45 AM   #5
friso
New Member
 
Join Date: Apr 2002
Posts: 25
Default

thanks but it doesn't work at all

anyone else??

friso is offline   Reply With Quote
Old Apr 10th, 2002, 03:46 AM   #6
Audiojoe
Board Regular
 
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
Default

So what you're saying is, that as soon as the userform is diplayed, you want the macro to run, right? If this is so, what's the name of your macro?
Audiojoe is offline   Reply With Quote
Old Apr 10th, 2002, 03:52 AM   #7
friso
New Member
 
Join Date: Apr 2002
Posts: 25
Default

hi this is the entire code for the macro:


Sub ShowIt_Now()
Consolform2.Show
End Sub

Sub ShowIt_Now2()
Consolform2.Hide
End Sub




Sub ButtonKolomConsol_Click()
ShowIt_Now
ButtonInfra_Click
Consolform2.Label2.Caption = "l"
ButtonProducts_Click
Consolform2.Label2.Caption = "ll"
ButtonProcesses_Click
Consolform2.Label2.Caption = "lll"
ButtonEA_Click
Consolform2.Label2.Caption = "llll"
ButtonCIB_Click
Consolform2.Label2.Caption = "llll"
ButtonRM_Click
Consolform2.Label2.Caption = "lllll"
Worksheets("Consol-Kolom").Select
Range("A3:BB602").Select
Selection.Clear

Worksheets("DB-Kolom").Select
Range("A1:BD595").Select
Application.CutCopyMode = False
Selection.Copy
Worksheets("Consol-Kolom").Select
Range("A3:BD597").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False


Dim rRange As Range
With Sheets("Consol-Kolom")

Set rRange = .Range("A3", .Range("A65536").End(xlUp)).Offset(0, 70)

rRange.FormulaR1C1 = "=IF(RC[-68]=RC[-69],1,"""")"

Set rRange = rRange.SpecialCells(xlCellTypeFormulas, _
xlNumbers)
rRange.EntireRow.Delete
End With

ShowIt_Now2
Worksheets("Consol-Kolom").Select
Range("A1").Select
End Sub


friso 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 09:50 AM.


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