![]() |
|
|
|
#1
|
||||
|
||||
|
"ows" is just my own idiosyncratic way of naming a worksheet. Most programmers learn eventually to use more descriptive variable names that just 'i' and 'j', 'x' and 'y'; eventually they start naming things "RetailWorksheet", "MonthlySum" and so forth.
Now, like them I've learned that there's a risk of making a name so cryptic that six months later I've forgotten what it's for and have difficulty understanding my own code. But I still hate my variable names to be too long; it makes for longer statements, more typing and perhaps other sins that I've forgotten just now. So I still make my names a lot shorter than most folks do; I just pack more information into fewer characters. I long ago gave up using one-character variable names, for reasons that even some experienced programmers will disagree with. So instead of using 'i', 'j', 'k' and so forth, as is traditional for loop indices, I use 'j' plus another character, eg "jr" for rows or "jl" for "list number", whatever strikes my fancy at the time. For objects I'm currently trying to use 'o' as the starting character, then another character or two to indicate what kind of object. "ows" means "worksheet" to me; "owb" is a workbook, "oc" is a cell, "org" is a range and so on. These names evolve from time to time; in fact until very recently I used "wso", "co" etc. When I need to distinguish between more than one cell, worksheet or whatever, I add a few letters; owsFm and owsTo, for example, when I'm transferring data from one worksheet to another, or rA and rZ for first and last rows. But when I'm working with just one object of its type at a time, as in this case, I'm content to start a program like this: Code:
Set owb = ThisWorkbook Set ows = ActiveSheet And by the way all this idiosyncrasy is for my own programs. Whenever I write a program for a client, that someone else may have to maintain next year after I'm gone, then it's all out the window and I must choose names that are likely to mean something more generally, not just in my own personal code. |
|
#2
|
|||
|
|||
|
Bob,
Your logic is a good ideal. I usually use the first initial of the worksheet name. IE: If I have a sheet called Result the I use "Rws". As for the workbook I may use a couple of characters. Such as in a program I'm currently working on "HykeShop" I name it "Hykwb". |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Can I pre-populate cells with a formula?
|
Box | Excel | 1 | 05-03-2014 11:55 PM |
| How to populate cells in Sheet2 with Data Source query using cell data from Sheet1 | bobznkazoo | Excel | 2 | 03-27-2014 11:14 AM |
How-TO format cells (FILL) by comparing cells
|
zanat0s | Excel | 1 | 07-03-2012 04:27 AM |
| Count range cells eliminating merge cells | danbenedek | Excel | 0 | 06-15-2010 12:40 AM |
| Populate cells in Word from a database | hotlilshan | Word | 3 | 12-09-2008 01:51 PM |