Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 20th, 2005, 08:14 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
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
Reply With Quote
  #2 (permalink)  
Old January 20th, 2005, 08:37 AM
Authorized User
 
Join Date: Jun 2003
Location: Cape Town, Western Cape, South Africa.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:34 PM.


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