LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default .address / .value

hi...

i am doing a vlookup and usin a formula for that. i want to remove the
hardcoded values to as far extent i can. So that if any new column or new
row is added then the macro shouldnt fail. Which normally everyone does.

the below code is a small relevant part of my code. Its working perfectly
fine.
Set rng3 = Cells.Find("Package")
If rng3 Is Nothing Then MsgBox "Could not locate column Package in the
worksheet "" & DataWorksheet1Name & "" in workbook " & wkBkName & "."
c1 = Cells(rng3.Row + 1, rng3.Column).Address 'STARTING RANGE

Set rng4 = Cells.Find("Q4")
If rng4 Is Nothing Then MsgBox "Could not locate column ""Q4"" in the
worksheet " & DataWorksheet1Name & " in workbook " & wkBkName
c2 = Cells(tcrLastCell, rng4.Column).Address 'ENDING RANGE

For z = lastCol3 + 1 To lastCol4
rowSt = LNewRng.Row + 1
While rowSt <= LastCellNum - 1
Cells(rowSt, z).Value = "=( VLOOKUP(" & Cells(rowSt,
packRng.Column).Address & "," & ext & "!" & c1 & ":" & c2 & ","
& f1 & ",FALSE)" & ")"
rowSt = rowSt + 1
Wend
next z

teh above formula gets resolved as below in each cell.
=( VLOOKUP($F$10,'C:\Documents and Settings\ASSY\Desktop\excel-vba\Input
files\[TCR2003_Assembly_0305.xls]TCR2003 by packages'!$B$4:$G$238,4,FALSE))

$F$10 comes because i am using the ".address ". The requiremetn is thati
need to have the reference of the cell i am using hte value of. So i cannot
use ".value". But now the requirement is that what if another row I insert a
row inbetween $F$10 and $F$11.... this $F$11 does cahnge to $F$12/.... but
the person cannot copy the vloopup formala from any of the cell and use
it.... like in this case if i copy the row 10 formula then I get the same
values for that same $F$10 value. where i want that whatever is inserted in
$F$11 teh value for vlookup should cahnge which is not happening.

am i missing something??? or do i need to use anyother object.... which
would solve my problem.

thanks to those who read this and respond.

Monika


 
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
The address of this site is not valid. Check the address and try kevin Excel Discussion (Misc queries) 1 February 11th 09 01:30 PM
How do I avoid excel change absolute address to relative address Miguel Excel Discussion (Misc queries) 3 May 10th 07 11:18 PM
long address list, name-address-city, listed vertically, how do y. kb Excel Discussion (Misc queries) 2 March 4th 05 12:48 AM
How do I import Office address book to Outlook Express address bo. snnorp Excel Discussion (Misc queries) 2 February 22nd 05 11:47 AM
LINKING Address cells from an EXCEL spreadsheet to fill MapQuest Address Info Duane S. Meyer Excel Programming 0 August 30th 03 12:16 AM


All times are GMT +1. The time now is 07:01 AM.

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"