Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto Fill in Formula Per New Line

I have an formula that I would like to fill downwards on the entering
of data in a column next. The formula I have is bellow;

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 5 Then
If Not IsEmpty(Target.Value) Then
Target.Offset(0, 1).FormulaR1C1 = "=RC[-1]*6"
End If
End If
End Sub

This is fine apart from when I change the formula to
"=IF(R$1=G2,"Yes","No")" a syntax error is shown.

I am probably going about this entirely the wrong way but any help
would be much appreaciated.

The end goal is to have the formula automaticaly entered every time a
new line is added to the sheet

Thanks

Jason
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto Fill in Formula Per New Line

"=IF(R$1=G2,""Yes"",""No"")"

You have to put in 2 double quotes within a string to get one double quote
to appear in the string. When you only put in one double quote as your
formla string showed, excel interpreted the second one as the end of the
string.

Testing in the immediate window:

? "=IF(R$1=G2,""Yes"",""No"")"
=IF(R$1=G2,"Yes","No")


--
Regards,
Tom Ogilvy

"Jason P" wrote in message
om...
I have an formula that I would like to fill downwards on the entering
of data in a column next. The formula I have is bellow;

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 5 Then
If Not IsEmpty(Target.Value) Then
Target.Offset(0, 1).FormulaR1C1 = "=RC[-1]*6"
End If
End If
End Sub

This is fine apart from when I change the formula to
"=IF(R$1=G2,"Yes","No")" a syntax error is shown.

I am probably going about this entirely the wrong way but any help
would be much appreaciated.

The end goal is to have the formula automaticaly entered every time a
new line is added to the sheet

Thanks

Jason



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
Auto Fill formula when inserting a new line SRiddle Excel Discussion (Misc queries) 4 April 20th 11 09:56 PM
Possible to auto-fill in gaps between numbers on straight line bas sticky Excel Worksheet Functions 1 January 30th 09 05:52 AM
Auto formula fill Connie Martin Excel Discussion (Misc queries) 5 December 19th 06 08:01 PM
Auto fill of formula ksr Excel Worksheet Functions 7 June 6th 06 05:46 PM
Formula auto-fill help!! daveycmc Excel Worksheet Functions 1 April 11th 06 05:31 PM


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