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 November 14th, 2005, 04:04 PM
Authorized User
 
Join Date: Oct 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loop Problems

Can someone tell me whats wrong with this:

Code:
Sub SwapDate()

Dim ocell as range

For each oCell in Selection
   If Isempty(activecell) Then
      oCell.FormulaR1C1 = "=RC[24]"
   End If
Next

End Sub
When I run the code it only does one cell then the activecell jumps up 4 rows.

 
Old November 15th, 2005, 02:37 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Change this row
If Isempty(activecell) Then
to
If Isempty(oCell) Then

-vemaju









Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help with loop... cbtidball Access VBA 4 February 22nd, 2006 09:55 AM
For loop problems cube Beginning VB 6 2 November 29th, 2004 04:01 PM
Do While Loop Problems gmoney060 Classic ASP Databases 2 August 8th, 2004 08:52 PM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





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