Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Add value to the content of a cell with Vlookup

Hi I have this piece of code add to the content of the cell selected a
figure that I will find with a vlookup function into another
spreadsheet (book1), but it cause an error?

can you help?

Sub update_figures()
Dim Q1_bill As Integer
Dim Total As Integer
Dim rng As Range

Set rng = Workbooks("Book1").Sheets("Pivot").Range("A6:U215" )

For i = 2 To 200

Q1_bill = ActiveSheet.Range("u" & i).Value

Total = Q1_bill + Application.VLookup("b" & i, rng, 19, False)

ActiveSheet.Range("u" & i).Select = Total

Next i

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Add value to the content of a cell with Vlookup

On Sep 1, 9:56*am, Nicawette wrote:
Hi I have this piece of code add to the content of the cell selected a
figure that I will find with a vlookup function into another
spreadsheet (book1), but it cause an error?

can you help?

Sub update_figures()
Dim Q1_bill As Integer
Dim Total As Integer
Dim rng As Range

Set rng = Workbooks("Book1").Sheets("Pivot").Range("A6:U215" )

For i = 2 To 200

Q1_bill = ActiveSheet.Range("u" & i).Value

Total = Q1_bill + Application.VLookup("b" & i, rng, 19, False)

ActiveSheet.Range("u" & i).Select = Total

Next i

End Sub


Several errors.
Fully specify the workbook with .xls
Use proper syntax for the vlookup
'=====
option explicit
Sub lookupmacro()' Modify to suit
Dim rng As Range
Dim i As Long
Set rng = Workbooks("20100801.xls").Sheets("Sheet9").Range(" A6:U215")

For i = 2 To 5
Cells(i, "u") = Application.VLookup(Cells(i, "b"), rng, 19, 0)
Next i
End Sub
'======
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Add value to the content of a cell with Vlookup

thank you Don
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
Content of cell in Vlookup function Ernie Fenwick Excel Worksheet Functions 3 December 31st 08 07:16 PM
vlookup - extracting cell content from external spread sheet Christian[_4_] Excel Worksheet Functions 3 February 25th 08 03:59 AM
Conditional formatting formula that uses VLookup, based on content of another cell Fred Excel Discussion (Misc queries) 2 August 3rd 06 10:38 AM
Conditional formatting formula that uses VLookup, based on content of another cell Fred Excel Discussion (Misc queries) 3 August 2nd 06 04:23 PM
vlookup to extract part cell content excelFan Excel Discussion (Misc queries) 2 December 5th 04 08:45 AM


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