Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA Code Correction

Hi All, thanks a million in advance!

my Current code is:

Range ("B9").Select
Dim i As Integer
For i = 4 to 7
ActiveCell.FormulaR1C1 = "R[-i]C[4]"
Next i
End Sub

This does not work. Im trying to set cell B9= to A6 (in this example),
then repeat the code with i=5 meaning B9 should now = A5 (in this
example). Could anyone help please. Thanks

Rich

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default VBA Code Correction

Without asking what this code is supposed to do <g :

Range ("B9").FormulaR1C1 = "R[-" & i & "]C[4]"

Try to avoid Select unless you really need to guide the user around.

HTH. Best wishes Harald

"RichIT" skrev i melding
ps.com...
Hi All, thanks a million in advance!

my Current code is:

Range ("B9").Select
Dim i As Integer
For i = 4 to 7
ActiveCell.FormulaR1C1 = "R[-i]C[4]"
Next i
End Sub

This does not work. Im trying to set cell B9= to A6 (in this example),
then repeat the code with i=5 meaning B9 should now = A5 (in this
example). Could anyone help please. Thanks

Rich



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBA Code Correction

Sub Dosomething()
Range ("B9").Select
Dim i As Integer
For i = 4 to 7
ActiveCell.FormulaR1C1 = "R[" & -i & "]C[-1]"
Msgbox Activecell.formula
Next i
End Sub

--
Regards,
Tom Ogilvy


"RichIT" wrote:

Hi All, thanks a million in advance!

my Current code is:

Range ("B9").Select
Dim i As Integer
For i = 4 to 7
ActiveCell.FormulaR1C1 = "R[-i]C[4]"
Next i
End Sub

This does not work. Im trying to set cell B9= to A6 (in this example),
then repeat the code with i=5 meaning B9 should now = A5 (in this
example). Could anyone help please. Thanks

Rich


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
Date Correction JPS Excel Worksheet Functions 4 July 11th 08 11:34 AM
Value correction P. Zicari Excel Discussion (Misc queries) 2 April 15th 08 07:28 PM
Code Correction Need Safi Excel Programming 0 July 30th 06 06:05 PM
correction to the question Mir Khan Excel Programming 1 May 9th 06 02:56 AM
correction nowfal Excel Discussion (Misc queries) 4 March 24th 06 06:40 PM


All times are GMT +1. The time now is 09:27 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"