Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default ActiveCell.FormulaR1C1 referencing a moving target.

j = Activecell.Column
For i = 2 To 18 Step 8
Cells(Activecll.Row, j).FormulaR1C1 = "=SheetName!R[" & i & "]C"
j = j + 1
Next i

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"colin919" wrote in message
...
My current situation is:

ActiveCell.FormulaR1C1 = "=SheetName!R[2]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SheetName!R[10]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SheetName!R[18]C"
etc......

I would like to replace the row with an integer increasing by 8 therefore
creating a small loop. VB at the moment does not seem to understand my
request. Is there an easier way to do this? Please help!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default ActiveCell.FormulaR1C1 referencing a moving target.

Are you sure it works <G.? Looking again it seems to me I have rows and
columns mixed up. Assuming it does

With Worksheets("SheetName")
j = Activecell.Column
For i = 2 To .Cells(.Rows.Count, j).End(xlUp).Row Step 8
.Cells(Activecell.Row, j).FormulaR1C1 = "=SheetName!R[" & i &
"]C"
j = j + 1
Next i
End With

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"colin919" wrote in message
...
Works great!
But it created another question. How do I word the "Do while loop" to run
until the data in the "Sheetname" cell is emptycell? My syntax does not
seem
to be working.

"Bob Phillips" wrote:

j = Activecell.Column
For i = 2 To 18 Step 8
Cells(Activecll.Row, j).FormulaR1C1 = "=SheetName!R[" & i & "]C"
j = j + 1
Next i

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"colin919" wrote in message
...
My current situation is:

ActiveCell.FormulaR1C1 = "=SheetName!R[2]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SheetName!R[10]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SheetName!R[18]C"
etc......

I would like to replace the row with an integer increasing by 8
therefore
creating a small loop. VB at the moment does not seem to understand my
request. Is there an easier way to do this? Please help!






Reply
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
ActiveCell.FormulaR1C1 Rick Excel Discussion (Misc queries) 3 March 28th 10 10:36 PM
ActiveCell.FormulaR1C1 PapaDos Excel Programming 0 December 7th 06 07:06 AM
ActiveCell.FormulaR1C1 Tom Ogilvy Excel Programming 0 December 6th 06 08:03 PM
activecell.formular1c1 monika Excel Programming 0 April 29th 04 10:13 AM
ActiveCell.FormulaR1C1 Leif Rasmussen Excel Programming 1 October 16th 03 09:46 AM


All times are GMT +1. The time now is 12:39 PM.

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

About Us

"It's about Microsoft Excel"