Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Can someone help me with this code

I found this code on this NG and used it successfully several times.
But I have modified it slightly, to use a different formula and It returns
an error: Application Defined or Object Defined Error.

I don't know what this means.

This is the code which I sourced from Don Guillet:

Sub balance()' I use for a running balance in a checkbook.
Set frng = Range("b3:b" & Range("a65536").End(xlUp).Row)
With frng
..Formula= "vlookup(a1,sheet2!a2:z200,2,false)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value
End With
End Sub


This is my modified code:
Sub Balance()
Set frng = Range("L4:L" & Range("B65536").End(xlUp).Row)

With frng
..Formula = "=IF(K4=1,"",F4-D4)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value

End With

End Sub
I have used several successful variations to my version of the code, but
this formula "=IF(K4=1,"",F4-D4)" gives me the problem.

I don't know much about writing macros.
Can anyone offer an explanation and a fix for this please.
Cheers Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Can someone help me with this code

Try taking out the first or second '.' in

...Formula = "=IF(K4=1,"",F4-D4)"

Best of luck
DavidC

-----Original Message-----
I found this code on this NG and used it successfully

several times.
But I have modified it slightly, to use a different

formula and It returns
an error: Application Defined or Object Defined Error.

I don't know what this means.

This is the code which I sourced from Don Guillet:

Sub balance()' I use for a running balance in a checkbook.
Set frng = Range("b3:b" & Range("a65536").End(xlUp).Row)
With frng
..Formula= "vlookup(a1,sheet2!a2:z200,2,false)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value
End With
End Sub


This is my modified code:
Sub Balance()
Set frng = Range("L4:L" & Range("B65536").End(xlUp).Row)

With frng
..Formula = "=IF(K4=1,"",F4-D4)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value

End With

End Sub
I have used several successful variations to my version

of the code, but
this formula "=IF(K4=1,"",F4-D4)" gives me the problem.

I don't know much about writing macros.
Can anyone offer an explanation and a fix for this please.
Cheers Paul
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can someone help me with this code

Hi Paul,

You need to double the double quotes.

Replace:

.Formula = "=IF(K4=1,"",F4-D4)"

with

.Formula = "=IF(K4=1,"""",F4-D4)"


---
Regards,
Norman



"Paul" wrote in message
om...
I found this code on this NG and used it successfully several times.
But I have modified it slightly, to use a different formula and It returns
an error: Application Defined or Object Defined Error.

I don't know what this means.

This is the code which I sourced from Don Guillet:

Sub balance()' I use for a running balance in a checkbook.
Set frng = Range("b3:b" & Range("a65536").End(xlUp).Row)
With frng
.Formula= "vlookup(a1,sheet2!a2:z200,2,false)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value
End With
End Sub


This is my modified code:
Sub Balance()
Set frng = Range("L4:L" & Range("B65536").End(xlUp).Row)

With frng
.Formula = "=IF(K4=1,"",F4-D4)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value

End With

End Sub
I have used several successful variations to my version of the code, but
this formula "=IF(K4=1,"",F4-D4)" gives me the problem.

I don't know much about writing macros.
Can anyone offer an explanation and a fix for this please.
Cheers Paul



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Can someone help me with this code

Thanks very much Norman.
That did the trick.

And thanks to DavidC for replying also.

Cheers Paul

"Norman Jones" wrote in message ...
Hi Paul,

You need to double the double quotes.

Replace:

.Formula = "=IF(K4=1,"",F4-D4)"

with

.Formula = "=IF(K4=1,"""",F4-D4)"


---
Regards,
Norman



"Paul" wrote in message
om...
I found this code on this NG and used it successfully several times.
But I have modified it slightly, to use a different formula and It returns
an error: Application Defined or Object Defined Error.

I don't know what this means.

This is the code which I sourced from Don Guillet:

Sub balance()' I use for a running balance in a checkbook.
Set frng = Range("b3:b" & Range("a65536").End(xlUp).Row)
With frng
.Formula= "vlookup(a1,sheet2!a2:z200,2,false)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value
End With
End Sub


This is my modified code:
Sub Balance()
Set frng = Range("L4:L" & Range("B65536").End(xlUp).Row)

With frng
.Formula = "=IF(K4=1,"",F4-D4)"
' .Formula = "=h7+d8"
.Formula = .Value 'changes the formula to value

End With

End Sub
I have used several successful variations to my version of the code, but
this formula "=IF(K4=1,"",F4-D4)" gives me the problem.

I don't know much about writing macros.
Can anyone offer an explanation and a fix for this please.
Cheers Paul

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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM


All times are GMT +1. The time now is 05:28 PM.

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

About Us

"It's about Microsoft Excel"