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 25th, 2002, 02:44 PM   #1
271553
New Member
 
Join Date: Mar 2002
Location: David Weintraub
Posts: 2
Default

Would like to know if there is a way I can have Excel generate a receptor grid (array of x and y) based on specific corner or end points. For example, to generate a 100 meter spacing between zero and 10,000 meters in both x and y directions. Also is there a way to exclude specific locations within the grid array to say form a "doughnut" or area of no data.
271553 is offline   Reply With Quote
Old Mar 25th, 2002, 07:26 PM   #2
Damon Ostrander
MrExcel MVP
 
Damon Ostrander's Avatar
 
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
Default

Hi David,

I'm not at all sure what your question is, so maybe others are confused as well. I think some clarification would be helpful.

If you are wanting Excel to draw a special grid, or perhaps position tick marks at certain places on a page or drawing, this is easy to do, but I'm not at all sure if this is what you want. I know it is hard to describe something that is essentially graphical in words, but perhaps you could manually draw a picture using the drawing objects and attach it to your question to help us visualize what you want.

__________________
Keep Excelling.

Damon

VBAexpert Excel Consulting
(My other life: http://damonostrander.com )
Damon Ostrander is offline   Reply With Quote
Old Mar 26th, 2002, 10:40 AM   #3
271553
New Member
 
Join Date: Mar 2002
Location: David Weintraub
Posts: 2
Default

Damon,

Thanks for the reply. I have manually created a sample grid in Excel as a X-Y Scatter Chart to show all. However, being new to message boards, not sure how to import for display. Where are the drawing object tools you mention within the browser or this website. The cut and paste tool within my browser didn't seem to work. How do you attach files or bring into this reply message box?

Hopefully, my rephrasing the question will preclude me from having to generate a graphic:

I would like Excel to automatically generate data points (receptors), X and Y coordinates in Columns A and B starting from say 0,0 to 10000, 10000 in steps (increment) of 100 meters. I realize that this will create quite a number of rows, but I believe Excel X-Y Scatter charts must have data in two columns.

0 0
0 100
0 200
0 300
.. ..
0 2000
100 0
100 100
100 200
100 300
.. ..
100 2000 . . .
200 100
200 200
200 300
.. ..
200 2000. . .
.. ..
2000 0
2000 100
2000 200
2000 300
.. ..
2000 2000

Any help would be appreciated.
271553 is offline   Reply With Quote
Old Mar 26th, 2002, 01:10 PM   #4
Damon Ostrander
MrExcel MVP
 
Damon Ostrander's Avatar
 
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
Default

Hi again David,

I think I understand better now. I did not know that you intended to represent the data on a scatter plot. I believe you just want a macro that automatically generates the data points? If so, here is such a macro:

Sub GridCoordinates()
Dim iRow As Long
Dim Xval As Single
Dim Yval As Single
iRow = 1 'start inserting values in row 1
For Xval = 0 To 10000 Step 100
For Yval = 0 To 10000 Step 100
Cells(iRow, 1) = Xval
Cells(iRow, 2) = Yval
iRow = iRow + 1
Next Yval
Next Xval
Beep 'done
End Sub


A few extra lines of code are needed to eliminate all coordinates that fall within an annular area (I believe you referred to a "donut"). Here's an example:

Sub GridCoordinates()
Dim iRow As Long
Dim Xval As Single
Dim Yval As Single
Dim Rinner As Single 'annulus inner radius
Dim Router As Single 'annulus outer radius
Dim R0x As Single 'annulus center x-coordinate
Dim R0y As Single 'annulus center y-coordinate
Dim Radius As Single

'The following values are just for example purposes
Rinner = 3000
Router = 6000
R0x = 5000
R0y = 5000

iRow = 1 'start inserting values in row 1
For Xval = 0 To 10000 Step 100
For Yval = 0 To 10000 Step 100
Radius = Sqr((Xval - R0x) ^ 2 + (Yval - R0y) ^ 2)
'do not include points within annulus
If Radius < Rinner Or Router < Radius Then
Cells(iRow, 1) = Xval
Cells(iRow, 2) = Yval
iRow = iRow + 1
End If
Next Yval
Next Xval
Beep 'done
End Sub

Regarding the graphical representation, I was really just referring to using the drawings capability (not charts) built in to Excel. But I just found out that the feature of being able to attach files to postings on this BB has not yet been implemented, so that was a bad idea anyway. I hope the above code helps. This code should be pasted into a macro module.

__________________
Keep Excelling.

Damon

VBAexpert Excel Consulting
(My other life: http://damonostrander.com )
Damon Ostrander 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 08:29 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