#1   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default VLOOKUP as a vb code

How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default VLOOKUP as a vb code

Try this:

x = Application.WorksheetFunction.VLookup(Range("AZ4") , Sheet3.Range("A:B"),
2, 0)

Regards,
Per

"Tdp" skrev i meddelelsen
...
How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp


  #3   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default VLOOKUP as a vb code

Thanks Per that seems to work fine
Many thanks
--
Tdp


"Per Jessen" wrote:

Try this:

x = Application.WorksheetFunction.VLookup(Range("AZ4") , Sheet3.Range("A:B"),
2, 0)

Regards,
Per

"Tdp" skrev i meddelelsen
...
How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp



  #4   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default VLOOKUP as a vb code

Just one more question Per
With this code how do I include if the cell is empty then show zero?
--
Tdp


"Tdp" wrote:

Thanks Per that seems to work fine
Many thanks
--
Tdp


"Per Jessen" wrote:

Try this:

x = Application.WorksheetFunction.VLookup(Range("AZ4") , Sheet3.Range("A:B"),
2, 0)

Regards,
Per

"Tdp" skrev i meddelelsen
...
How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default VLOOKUP as a vb code

Hi Tdp

As you don't write which cell could be empty I assume that it's AZ4.

If Range("AZ4").Value = "" Then
x = 0
Else
x = Application.WorksheetFunction.VLookup(Range("AZ4") ,
Sheet3.Range("A:B"), 2, 0)
End If

Regards,
Per
"Tdp" skrev i meddelelsen
...
Just one more question Per
With this code how do I include if the cell is empty then show zero?
--
Tdp


"Tdp" wrote:

Thanks Per that seems to work fine
Many thanks
--
Tdp


"Per Jessen" wrote:

Try this:

x = Application.WorksheetFunction.VLookup(Range("AZ4") ,
Sheet3.Range("A:B"),
2, 0)

Regards,
Per

"Tdp" skrev i meddelelsen
...
How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp





  #6   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default VLOOKUP as a vb code

Sorry about that.......I forgot.
It works well now. I only made one change to it

If Range("AZ14").Value = "" Then
Range("BB14").Value = ""
Else
Range("BB14").Value =
Application.WorksheetFunction.VLookup(Range("AZ14" ), Sheet3.Range("A:B"), 2,
0)
End If

Many thanks
--
Tdp


"Per Jessen" wrote:

Hi Tdp

As you don't write which cell could be empty I assume that it's AZ4.

If Range("AZ4").Value = "" Then
x = 0
Else
x = Application.WorksheetFunction.VLookup(Range("AZ4") ,
Sheet3.Range("A:B"), 2, 0)
End If

Regards,
Per
"Tdp" skrev i meddelelsen
...
Just one more question Per
With this code how do I include if the cell is empty then show zero?
--
Tdp


"Tdp" wrote:

Thanks Per that seems to work fine
Many thanks
--
Tdp


"Per Jessen" wrote:

Try this:

x = Application.WorksheetFunction.VLookup(Range("AZ4") ,
Sheet3.Range("A:B"),
2, 0)

Regards,
Per

"Tdp" skrev i meddelelsen
...
How do I change the following as a vb code???
=VLOOKUP(AZ4,Sheet3!A:B,2,0)
--
Tdp




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
Code required for VLookup returning #NA Marie Bayes Excel Discussion (Misc queries) 7 January 10th 07 04:01 PM
Using VLOOKUP in VBA code Mark Excel Worksheet Functions 2 August 18th 06 04:41 PM
VLOOKUP code needed please j4ymf Excel Worksheet Functions 4 March 12th 06 07:48 PM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
how to use a VLOOKUP function in a VBA code? Sunil New Users to Excel 3 June 13th 05 09:27 AM


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