#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 49
Default Macro problems

Hi everybody

My formula looks exactly like this:


Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*))))"

Formula = .Value 'changes to a value if desired
End With
End Sub


As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?


And what can I use this line for?


Formula = .Value 'changes to a value if desired


/Heine

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Macro problems

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:


Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub


As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?


And what can I use this line for?


Formula = .Value 'changes to a value if desired


/Heine


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Macro problems

If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.

Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 49
Default Macro problems

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

..Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine


Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.

Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Macro problems

Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 49
Default Macro problems

It shouldn´t matter should it? I can always change it to the
traditional way if it´s a problem


Dave Peterson wrote:
Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =
"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all the

cells in column O from row 9 - that is it should return the result of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine

--

Dave Peterson


--

Dave Peterson


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Macro problems

It shouldn't be that, the formula should install okay, it would just show an
error in the cell.

Did you notice Dav e's follow-up post to mine where he suggested using
commas in VBA n ot semi-colons. That could throw the application error. Try
it with

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) )," & _
""""",(vlookup(a9,råb1,3,false))))"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
ps.com...
It shouldn´t matter should it? I can always change it to the
traditional way if it´s a problem


Dave Peterson wrote:
Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _

"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =

"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all

the

cells in column O from row 9 - that is it should return the result

of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine

--

Dave Peterson


--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 49
Default Macro problems

So I replace the formula in the below macro with the one you gave me?

What about the line?

.Formula = sFormula



Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3*;

false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub




Bob Phillips wrote:
It shouldn't be that, the formula should install okay, it would just show an
error in the cell.

Did you notice Dav e's follow-up post to mine where he suggested using
commas in VBA n ot semi-colons. That could throw the application error. Try
it with

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) )," & _
""""",(vlookup(a9,råb1,3,false))))"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
ps.com...
It shouldn´t matter should it? I can always change it to the
traditional way if it´s a problem


Dave Peterson wrote:
Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _

"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =

"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all

the

cells in column O from row 9 - that is it should return the result

of
the formula in the entire column (almost) - but nothing happens. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine

--

Dave Peterson


--

Dave Peterson


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 49
Default Macro problems

It actually works now - thanks guys!
Heine wrote:
So I replace the formula in the below macro with the one you gave me?

What about the line?

.Formula = sFormula



Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3*;

false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub




Bob Phillips wrote:
It shouldn't be that, the formula should install okay, it would just show an
error in the cell.

Did you notice Dav e's follow-up post to mine where he suggested using
commas in VBA n ot semi-colons. That could throw the application error. Try
it with

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) )," & _
""""",(vlookup(a9,råb1,3,false))))"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
ps.com...
It shouldn´t matter should it? I can always change it to the
traditional way if it´s a problem


Dave Peterson wrote:
Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _

"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =

"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in all

the

cells in column O from row 9 - that is it should return the result

of
the formula in the entire column (almost) - but nothing happens.. Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine

--

Dave Peterson

--

Dave Peterson


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Macro problems

That is only where the error shows, the problem is elsewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
So I replace the formula in the below macro with the one you gave me?

What about the line?

.Formula = sFormula



Sub makeformulae()
Dim frng As Range
Const sFormula As String = _
"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3*
;

false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub




Bob Phillips wrote:
It shouldn't be that, the formula should install okay, it would just show

an
error in the cell.

Did you notice Dav e's follow-up post to mine where he suggested using
commas in VBA n ot semi-colons. That could throw the application error.

Try
it with

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) )," & _
""""",(vlookup(a9,råb1,3,false))))"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
ps.com...
It shouldn´t matter should it? I can always change it to the
traditional way if it´s a problem


Dave Peterson wrote:
Do you really have a range named: råb1


Heine wrote:

Hi Bob,

thanks for yout input. However this line doesn´t seem to work:

.Formula = sFormula

"Application or object defined error" it says.

Any thoughts?

/Heine

Dave Peterson wrote:
If Bob's formula didn't work, then I'd try:

Const sFormula As String = _
"=if(a9="""","""",if(isna(vlookup(a9,råb1,3,false) ),""""," & _
"(vlookup(a9,råb1,3,false))))"

Semicolons have been replaces with commas--VBA is pretty USA

centric.



Bob Phillips wrote:

Sub makeformulae()
Dim frng As Range
Const sFormula As String = _


"=if(a9="""";"""";if(isna(vlookup(a9;råb1;3;false) );"""";(vlookup(a9;råb1;3;
false))))"
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count,

"O").End(xlUp).Row)
With frng
.Formula = sFormula
.Value = .Value
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Heine" wrote in message
oups.com...
Hi everybody

My formula looks exactly like this:

Sub makeformulae()
Sheets("Bogholderi").Select
Set frng = Range("O9:O" & Cells(Rows.Count, "O").End(xlUp).Row)
With frng
Formula =


"=if(a9="";"";if(isna(vlookup(a9;råb1;3;false));"" ;(vlookup(a9;råb1;3;false*
))))"

Formula = .Value 'changes to a value if desired
End With
End Sub

As I understand it this should set my defined formula active in

all
the

cells in column O from row 9 - that is it should return the result

of
the formula in the entire column (almost) - but nothing happens.

Any
thoughts?

And what can I use this line for?

Formula = .Value 'changes to a value if desired

/Heine

--

Dave Peterson


--

Dave Peterson



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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
How to stop Excel remembering/loading macro from previously opened Workbook Norman Yuan Excel Discussion (Misc queries) 4 June 17th 06 04:13 PM
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


All times are GMT +1. The time now is 09:08 AM.

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"