LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default data validation using VBA, best practice?

I have 11 columns of data I want to validate before printing a
report. The plan is to write VBA code to do validate cell contents in
loops. In this case I want to see non-blanks in some columns, and
either numeric or specific text strings in other columns. Is there a
best practice, or is looping through every row of every column in
question and checking the cell contents standard practice?
TIA,
Mike


You'll find doing this in memory orders of magnitude more efficient
than looping cells directly. Simply 'dump' the entire range to be
vaidated into a variant to get a 2D array. Then loop the array as
desired...

Dim vData, n&, j&

vData = Range("A1:L100")
For n = 1 To UBound(vData)
For j = 1 To UBOund(vData, 2)
'loops row n col by col
Debug.Print vData(n, j)

For n = 1 To UBound(vData, 2)
For j = 1 To UBOund(vData)
'loops col n row by row
Debug.Print vData(n, j)

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Best Practice - Transfer Data Neon520 Excel Programming 0 February 17th 09 09:39 PM
Best Practice - Transfer Data Neon520 Excel Programming 2 February 17th 09 09:25 PM
Activate Sheet Best Practice (Y/N?) when xFer data between sheets? [email protected] Excel Programming 2 July 3rd 07 04:52 PM
Transfer data from XL into Access: best practice quartz[_2_] Excel Programming 2 June 24th 05 09:30 PM


All times are GMT +1. The time now is 07:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"