Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2005, 08:14 AM
Authorized User
 
Join Date: Dec 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginners question

Hi

I need to loop through several colums and change blanks to zeros.
I know how to loop through a cloumn but how do I loop through several columns.

Thanks

Andrew

Cheers
Tony
__________________
Cheers
Tony
 
Old January 20th, 2005, 08:37 AM
Authorized User
 
Join Date: Jun 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your would write a loop inside a loop as follws:


'start code
Dim intCol as integer, intRow as integer

intCol = 1
intRow = 1


Do While intCol <> "your max value of columns"

  Do While intRow <> "your max value of rows"
    If Cells(intRow, intCol) = "" then Cells(intRow, intCol) = 0
    intRow = intRow + 1
    if intRow = "your max value of rows" Then Exit Do
  Loop
    intCol = intCol + 1
    if intRow = "your max value of Columns" Then Exit Do
Loop

'end code





Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ projects for beginners 132591 C++ Programming 5 September 2nd, 2011 02:41 AM
A better book for beginners alexmbr BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 2 August 10th, 2007 04:52 AM
Beginners Error! aadz5 Apache Tomcat 2 February 13th, 2006 05:06 AM
Beginners book on CSS? larry HTML Code Clinic 3 January 13th, 2004 05:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.