Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 07-16-2014, 07:59 AM
BobBridges's Avatar
BobBridges BobBridges is offline Populate Cells with info contained in other cells Windows 7 64bit Populate Cells with info contained in other cells Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

"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
After that I can refer to ows.This and ows.That without thinking much about it.

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.
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Cells with info contained in other cells 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
Populate Cells with info contained in other cells 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft