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 21st, 2002, 09:04 PM   #1
chookers
Board Regular
 
Join Date: Mar 2002
Posts: 115
Default

Colo has given me some code which I have also used one line of before. Embarrassed to ask but can someone help me decipher it so I can use it on my own next time and know what it means!!

Thank you so much -

Here it is...

With Range ([A5], [A65536].End (xlUp))

Since I am working with A5 and below, I have that one sorted, but what does the rest of it do exactly, especially the [A65536]?

Thanks everyone!
chookers is offline   Reply With Quote
Old May 21st, 2002, 09:13 PM   #2
RET79
Board Regular
 
Join Date: Mar 2002
Location: England, UK.
Posts: 526
Default

Quote:
On 2002-05-21 20:04, chookers wrote:
Colo has given me some code which I have also used one line of before. Embarrassed to ask but can someone help me decipher it so I can use it on my own next time and know what it means!!

Thank you so much -

Here it is...

With Range ([A5], [A65536].End (xlUp))

Since I am working with A5 and below, I have that one sorted, but what does the rest of it do exactly, especially the [A65536]?

Thanks everyone!
It selects your range. The range starts at cell A5 and the end of the range is this [A65536].End (xlUp) thing.

Now for [A65536].End (xlUp), you might not have realised but an excel spreadsheet is only as big as 65536 rows and 256 columns (I think) so what that does is selects the cell in the bottom row of your column and the End(xlUp) takes it up to the first non blank cell.

Try it yourself, click on cell A65536 then press Ctrl&Up (which does the End(xlUp) bit). That's what it does!

RET79

[ This Message was edited by: RET79 on 2002-05-21 20:15 ]
RET79 is offline   Reply With Quote
Old May 21st, 2002, 09:33 PM   #3
chookers
Board Regular
 
Join Date: Mar 2002
Posts: 115
Default

oh thank you so much! Yes ok that makes perfect sense. I could not for the life of me work out the A65536!

ok so I am beginning to understand how it's used. Would this be the kind of thing you'd use to select the 'last row'? For example let's say you had a sheet which may not have the same number of rows everytime someone opens it, but you wanted them to be able to make all the font arial. Would you just do something like use the A65536 code and then, what, like this:

With Selection.Font
.Name=Arial
.Size=9
.ColorIndex=0

So basically the A655356 actually has selected it already? It can't possibly be that simple, can it?

My God, that's just excellent (am easily impressed!)

Thanks RET79!
chookers is offline   Reply With Quote
Old May 21st, 2002, 09:41 PM   #4
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

It's not quite that simple, but almost.

First,
You need to close the following:

With Selection.Font
.Name=Arial
.Size=9
.ColorIndex=0
end with 'close With Statements

Second,
65536 is the last row in a normal Excel worksheet. By performing an end(xlup) you've programatically performed the same operation as clicking on a65536 and pressing end then the up arrow, it effectively selects the last row with data in the sheet.

Colo has shown you how to select a5 and the last row of entered data in column A.

Hope this helps.


_________________
Cheers, NateO

[ This Message was edited by: NateO on 2002-05-21 20:42 ]
NateO is offline   Reply With Quote
Old May 21st, 2002, 09:59 PM   #5
chookers
Board Regular
 
Join Date: Mar 2002
Posts: 115
Default

Nate, Yeah sorry - forgot to close it!!

Ok so I just tested it out, got row A to change, then tried it for a few columns. Here's what I wrote:

Sub Macro1() '
' Macro1 Macro
' Macro recorded 22/05/2002 by The Principal


'
With Range([A5:D5], [A65536:D65536].End(xlUp))

.Font.Size = 20
.Font.ColorIndex = 0
End With

'
End Sub

So would that be the correct way to do it for a span of a few columns? (well it worked anyway!)Is there a better way or have I got the hang of it???

Am loving this and will use this one all the time!

Thank you ))))) well that sort of looks like double chins but you get the idea (or a worm or something)

Cheers!!
chookers is offline   Reply With Quote
Old May 21st, 2002, 10:04 PM   #6
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-21 20:59, chookers wrote:
Nate, Yeah sorry - forgot to close it!!

Ok so I just tested it out, got row A to change, then tried it for a few columns. Here's what I wrote:

Sub Macro1() '
' Macro1 Macro
' Macro recorded 22/05/2002 by The Principal


'
With Range([A5:D5], [A65536:D65536].End(xlUp))

.Font.Size = 20
.Font.ColorIndex = 0
End With

'
End Sub

So would that be the correct way to do it for a span of a few columns? (well it worked anyway!)Is there a better way or have I got the hang of it???

Am loving this and will use this one all the time!

Thank you ))))) well that sort of looks like double chins but you get the idea (or a worm or something)

Cheers!!
Thats the Ticket !...good on you The Principle

Are you The Principle!!


__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 21st, 2002, 10:06 PM   #7
RET79
Board Regular
 
Join Date: Mar 2002
Location: England, UK.
Posts: 526
Default

You've got the hang of it principal!!

RET79
RET79 is offline   Reply With Quote
Old May 21st, 2002, 10:37 PM   #8
chookers
Board Regular
 
Join Date: Mar 2002
Posts: 115
Default

Oh my God, I should hope a principal wouldn't be such a retard at expressing things! No no, I'm only a toady I'm afraid!

Ok well since I am on such a roll (you must be laughing, I am so behind all of you) anyway I am going to try and sort something out that Colo was helping me with yesterday which works great, but now I think I can get it even better with just a little tweaking. We were working on the basis of it being a worksheet change but I think instead I will do a macro button for it.

Here's what I have that I know does what I want:


Sub TEST()
With Range([A5], [A65536].End(xlUp))
.EntireRow.RowHeight = 90
End With
End Sub

Ok, well that is certainly impressive, isn't it?!!!

Here is what colo has done next (what we are going for with this bit is to border top/bottom of EACH row, in Coumns B:L):

With Cells(.Item(1).EntireRow.Row, 2).Resize(, 11)
.Borders(xlEdgeTop).LineStyle = xlContinuous
End With
With Cells(.Item(.Rows.Count).EntireRow.Row, 2).Resize(, 11)
.Borders(xlEdgeBottom).LineStyle = xlContinuous
End With
End With

Now this was intended as a worksheet change, but what if instead I wanted to apply it to a whole sheet. I could still do it under the A65536 code, but how can I tell it to select each individual row?

In the above code, I understand the 'borders xlEdgeBottom etc line, and am trying to understand the 2 and 11. Does that refer to column B and K(?) or L (?)Also why the need for 'resize' in that line?

Thank you! P.s I am hardly getting any work done with that open letter thing - unreal, I am compelled to keep reading it!!


chookers 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:28 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