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 3rd, 2002, 04:31 AM   #1
kotting
New Member
 
Join Date: Mar 2002
Posts: 17
Default

I have a worksheet where information from inputboxes from another sheet is deposited. I have arranged the information into nice neat rows. The problem is:

I want a checkbox on each row to strikeout the text on that row if the checkbox on that row is 'checked'. There are 365 rows on this worksheet in use. The solution I have requires that each checkbox 'code area' be filled with - (something along the lines of

If text is strikeout = true then strikeout =false

else strikeout = true

this works but I have to write a macro for each Checkbox for each row. Is there a way to do this without having to write 365 macros?
Thanks
kotting is offline   Reply With Quote
Old May 3rd, 2002, 04:41 AM   #2
crimlet
Board Regular
 
Join Date: May 2002
Location: Ipswich, Suffolk, England
Posts: 135
Default

I'm not sure what you are exactly trying to do, but I would put two suggestions forward. Either use the conditional formatting tool, or write a loop into your macro that repeats 360 times
crimlet is offline   Reply With Quote
Old May 3rd, 2002, 05:03 AM   #3
kotting
New Member
 
Join Date: Mar 2002
Posts: 17
Default

On my worksheet I have 365 rows of data. On each row I have a checkbox. If a 'user' checks the checkbox, I want the text in that row (only) to 'strikeout'. Sounds so simple yet the solution eludes me.
Thanks
kotting is offline   Reply With Quote
Old May 3rd, 2002, 08:46 PM   #4
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Could you not just use a cell reference to do what you are doing?
Would require much less work and a macro with less that a dozen lines...
Place an x or something into a cell for each row, lets say in column S...
Then use a macro to run down this column...
If an X is found, do your strike out text...
I have used many controls before and withour the ability to use control arrays in VBA it is a pain in the @$#.
You can write code which will write code if you know what I mean...
Write one procedure and assign it to a variable, then use the mid, left, and right to change the code and then duplicate it on a worksheet... You can then copy it to a module.

I don't know....
Have fun!
Tom
Tom

[ This Message was edited by: TsTom on 2002-05-03 19:50 ]
Tom Schreiner is offline   Reply With Quote
Old May 3rd, 2002, 11:52 PM   #5
Joe Was
MrExcel MVP
 
Joe Was's Avatar
 
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
Default

In line with TsTom's note;

This code copies rows that are marked to a new sheet. I use it to move priority items to a short list. The code may get you started? JSW

Sub Priority()
'Find all the rows ("A:G") that have a "X" in column "A" copy
'that row to the next blank row on a different sheet.

Application.ScreenUpdating = False
Worksheets("Want_Full").Select
For Each r In Worksheets("Want_Full").UsedRange.Rows
n = r.Row
If Worksheets("Want_Full").Cells(n, 1) = "X" Then
Worksheets("Want_Full").Range(Cells(n, 2), Cells(n, 7)).Copy _
Destination:=Worksheets("Want_Now").Range("B65536").End(xlUp).Offset(1, -1)
Else
End If
Next r

Worksheets("Want_Full").Columns("A").Replace What:="X", Replacement:="*", _
SearchOrder:=xlByColumns, MatchCase:=True

Range("Vendor").Select
Selection.Copy

Sheets("Want_Full").Select
ActiveWindow.ScrollRow = 1
Range("A1").Select

Sheets("Want_Now").Select
Range("B65536").End(xlUp).Offset(2, -1).Select
ActiveSheet.Paste

Range("A2").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Range("A2:F2").Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Selection.RowHeight = 4
Range("A1:F1").Select
Application.CutCopyMode = True
Application.ScreenUpdating = True

End Sub
Joe Was is offline   Reply With Quote
Old Nov 9th, 2005, 06:23 AM   #6
atomicluis
New Member
 
Join Date: Nov 2005
Posts: 7
Default

Hi,

I am trying to implement your code, but dont understand this line:

Range("Vendor").Select

what does "Vendoe" reference to ?

Thank you.
atomicluis is offline   Reply With Quote
Old Nov 9th, 2005, 10:43 AM   #7
Joe Was
MrExcel MVP
 
Joe Was's Avatar
 
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
Default

"Vendor" is just a named range, I used to pull a label, you do not need it.
__________________
JSW: Try and try again: "The way of the Coder!"
Joe Was is offline   Reply With Quote
Old Nov 10th, 2005, 11:59 PM   #8
atomicluis
New Member
 
Join Date: Nov 2005
Posts: 7
Default

Thanks for the response Joe Was,

I removed the following:

Range("Vendor").Select
Selection.Copy

...replaced "Want_Full" and "Want_Now" with my own sheets

run the code,but received the following error message:

Run-time error '1004'
Paste method of Worksheet class failed

on Debug, "ActiveSheet.Paste" is highlighted.

thank you
atomicluis is offline   Reply With Quote
Old Nov 11th, 2005, 03:49 PM   #9
Joe Was
MrExcel MVP
 
Joe Was's Avatar
 
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
Default

Remove all this from the code, I left it in so you can see how you can form,at and dress up the new list!
You don't need it!

Range("Vendor").Select
Selection.Copy

Sheets("Want_Full").Select
ActiveWindow.ScrollRow = 1
Range("A1").Select

Sheets("Want_Now").Select
Range("B65536").End(xlUp).Offset(2, -1).Select
ActiveSheet.Paste

Range("A2").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Range("A2:F2").Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Selection.RowHeight = 4
Range("A1:F1").Select


So you should have something like this:

Sub Priority()
'Find all the rows ("A:G") that have a "X" in column "A" copy
'that row to the next blank row on a different sheet.

Application.ScreenUpdating = False
Worksheets("Want_Full").Select
For Each r In Worksheets("Want_Full").UsedRange.Rows
n = r.Row
If Worksheets("Want_Full").Cells(n, 1) = "X" Then
Worksheets("Want_Full").Range(Cells(n, 2), Cells(n, 7)).Copy _
Destination:=Worksheets("Want_Now").Range("B65536").End(xlUp).Offset(1, -1)
Else
End If
Next r

Worksheets("Want_Full").Columns("A").Replace What:="X", Replacement:="*", _
SearchOrder:=xlByColumns, MatchCase:=True

Sheets("Want_Full").Select
ActiveWindow.ScrollRow = 1
Range("A1").Select

Application.CutCopyMode = True
Application.ScreenUpdating = True

End Sub
__________________
JSW: Try and try again: "The way of the Coder!"
Joe Was is offline   Reply With Quote
Old Nov 12th, 2005, 07:44 PM   #10
atomicluis
New Member
 
Join Date: Nov 2005
Posts: 7
Default

How come some rows are not pasted into the destination sheet ? the row that did not get pasted still got a "*" on column A.

For example: If the source sheet contains any number on cell "B2", and 'X' on cell A1. (destination sheet is empty). The number on cell B2 does not get pasted on the destination sheet.

thanks for the help. as you can assume I'm new to excel. thanks again.
atomicluis 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 03:10 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