Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2011, 07:54 AM
tinfanide tinfanide is offline How to use for loop in formula in VBA? Windows 7 64bit How to use for loop in formula in VBA? Office 2010 32bit
Expert
How to use for loop in formula in VBA?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default How to use for loop in formula in VBA?

Code:
With Application.Worksheets("ClassroomSittingPlan")

For x = 1 To 3
''''''''''''''''''''''''''''''''''''
.Cells(x, 1).Formula = "=Sum(B"&x&":C"&x&")"
''''''''''''''''''''''''''''''''''''
Next x

End With
In the Sum formula, how can I use the for loop variable in the formula?
Reply With Quote
  #2  
Old 12-06-2011, 08:33 AM
tinfanide tinfanide is offline How to use for loop in formula in VBA? Windows 7 64bit How to use for loop in formula in VBA? Office 2010 32bit
Expert
How to use for loop in formula in VBA?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Solved.
Code:
.Cells(x, 1).Formula = "=Sum(" & .Cells(x, 2).Address & ":" & .Cells(x, 3).Address & ")"
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use for loop in formula in VBA? How do I create slideshow that plays on loop? Olwen PowerPoint 1 08-25-2011 11:55 AM
music loop in powerpoint presentation genoMU69 PowerPoint 1 06-15-2011 08:00 AM
While loop not working right Cbrehm Excel Programming 0 05-11-2011 11:05 AM
How to use for loop in formula in VBA? Continuous Loop cksm4 Word 6 01-06-2011 09:03 PM
Outlook 2003 restart in a loop Stegel Outlook 0 06-29-2007 12:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:45 PM.


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