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 Mar 29th, 2002, 03:38 PM   #1
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

I'm probably missing something obvious here!

I have a column of names which has gaps occasionally in it (not in regular places) and I want it so that it copies to a blenk sheet as a column with no gaps so I can use it for a combobox.

Names will be added and deleted at various times and I want the solid list to stay upto date.

Thanks for any help in advance

Dan.
dan2 is offline   Reply With Quote
Old Mar 29th, 2002, 03:47 PM   #2
Chris Davison
MrExcel MVP
 
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
Default

HIghlight the range, hit F5 (goto), then special, then constants..... this will highlight your non-blank cells

click in the range to copy and paste to your new destination

(my original thought was copy / paste special / skip blanks, but this doesn't seem to work..... can any one explain what the skip blanks does ?)

hope this helps
Chris





edit..... ignore my question, I see what it does now.... grrrrr !

[ This Message was edited by: Chris Davison on 2002-03-29 14:51 ]
Chris Davison is offline   Reply With Quote
Old Mar 29th, 2002, 04:30 PM   #3
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

That would if I was to do it manually but the sheet the list is going to is hidden and the end user cant see it, so it needs to happen automatically with formulas on the hidden sheet.

Sorry for not explaining it properly.

Any ideas?

Dan.
dan2 is offline   Reply With Quote
Old Mar 29th, 2002, 04:39 PM   #4
Chris Davison
MrExcel MVP
 
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
Default

Jeez Dan, what am I ? A mind reader ?!!!

*chuckle*

not sure you can do this with formulae or without unhiding the sheet to do stuff.... you may find the VBA experts will sort you out though, they're good !

Sorry I couldn't fix your problem
Chris
Chris Davison is offline   Reply With Quote
Old Mar 29th, 2002, 04:46 PM   #5
Chris Davison
MrExcel MVP
 
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
Default

actually, couldn't you do what I suggested onto the existing visible sheet so you have your gap-less list

ie starting at D100

then just link the first cell in your hidden sheet to cell D100 on your original sheet and copy down.

(ie =originalsheet!D100)

or even =if(originalsheet!D100="","",+originalsheet!D100) which will not show a "0" in your list.

not as pretty as some swift VBA code though..

HTH
Chris
Chris Davison is offline   Reply With Quote
Old Mar 29th, 2002, 05:07 PM   #6
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

Thanks Chris

I agree with you I think it needs some VBA love to work smoothly.

Anyone know if this is possible in VBA?

Thanks
Dan.
dan2 is offline   Reply With Quote
Old Mar 29th, 2002, 05:43 PM   #7
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi dan2


What about just running some code on the names to sort them ? This will force out all blanks and give the user an alphabetical list.


Dave Hawley is offline   Reply With Quote
Old Mar 29th, 2002, 05:48 PM   #8
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

I would love to but unfortunately the users need them to stay in the same order.ie.

From To
John John
Mary Mary
Paul
Paul Fred

Fred

etc.

I'm starting to get a sore head over this one (

Anyone?

Dan.
dan2 is offline   Reply With Quote
Old Mar 29th, 2002, 05:54 PM   #9
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Stick with it Dan, there is always a way

With Sheet2
.Columns(1).EntireRow.SpecialCells(xlBlanks).Delete
.Range("A1", Range("A65536").End(xlUp)).Name = "MyRange"
End With
Combobox1.RowSource = "MyRange"



Dave Hawley is offline   Reply With Quote
Old Mar 29th, 2002, 06:35 PM   #10
daleyman
Board Regular
 
Join Date: Mar 2002
Location: London, UK
Posts: 167
Default

alternatively, should you want a bit more control....




Sub get_newlist()
'configure these settings...

source_sheetname = "sheet1"
source_column_number = 1
source_startrow = 1
source_endrow = 1000

destination_sheetname = "haha"
destination_column_number = 1
destination_startrow = 2


'clear destination column, you might want to change this to clear
'only the destination cells you want cleared, or add a line at the end
'of the procedure to put a title on the new list

Sheets(destination_sheetname).Cells(1, source_column_number).EntireColumn.ClearContents

'move nonblank values across
destinationrow = destination_startrow
For rowx = source_startrow To source_endrow
strg = Sheets(source_sheetname).Cells(rowx, source_column_number).Value
If strg <> "" Then
Sheets(destination_sheetname).Cells(destinationrow, destination_column_number).Value = strg
destinationrow = destinationrow + 1
End If
Next

End Sub


daleyman 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 12:27 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