Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Help with variable

Hello. I use the variable strbody in the body of an e-mail. The variable
collects that data from the worksheet nicely. I was hoping to add a vlookup
formula to it.

So for example, the variable picks up the PO numbers in a given row. On the
same sheet (but in a hidden range) I have a table with all PO numbers and
their description. I would love the variable to concatenate the PO number
with the PO description, and set THAT as the variable.

Thank you for your help!

Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
strbody = strbody & cell.Value & vbNewLine
Next


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with variable

Guessing that Cell contains the PO Numbers
Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
desc = application.Vlookup(cell.Value,Range("A1:C100"),2, 0)
if iserror(desc) then
sStr1 = ""
else
sStr1 = ", " & desc
end if
strbody = strbody & cell.Value & sStr1 & vbNewLine
Next


--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I use the variable strbody in the body of an e-mail. The variable
collects that data from the worksheet nicely. I was hoping to add a

vlookup
formula to it.

So for example, the variable picks up the PO numbers in a given row. On

the
same sheet (but in a hidden range) I have a table with all PO numbers and
their description. I would love the variable to concatenate the PO number
with the PO description, and set THAT as the variable.

Thank you for your help!

Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
strbody = strbody & cell.Value & vbNewLine
Next




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with variable

Something like

Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
PODesc=Application.VLOOKUP(cell.Value,Range("PODes cs"),2,False)
strbody = strbody & cell.Value & " " & PODesc & vbNewLine
Next

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steph" wrote in message
...
Hello. I use the variable strbody in the body of an e-mail. The variable
collects that data from the worksheet nicely. I was hoping to add a

vlookup
formula to it.

So for example, the variable picks up the PO numbers in a given row. On

the
same sheet (but in a hidden range) I have a table with all PO numbers and
their description. I would love the variable to concatenate the PO number
with the PO description, and set THAT as the variable.

Thank you for your help!

Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
strbody = strbody & cell.Value & vbNewLine
Next




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Help with variable

Thanks Tom!!

"Tom Ogilvy" wrote in message
...
Guessing that Cell contains the PO Numbers
Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
desc = application.Vlookup(cell.Value,Range("A1:C100"),2, 0)
if iserror(desc) then
sStr1 = ""
else
sStr1 = ", " & desc
end if
strbody = strbody & cell.Value & sStr1 & vbNewLine
Next


--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I use the variable strbody in the body of an e-mail. The
variable
collects that data from the worksheet nicely. I was hoping to add a

vlookup
formula to it.

So for example, the variable picks up the PO numbers in a given row. On

the
same sheet (but in a hidden range) I have a table with all PO numbers and
their description. I would love the variable to concatenate the PO
number
with the PO description, and set THAT as the variable.

Thank you for your help!

Set var = Range(Cells(ActiveCell.Row, "M"), _
Cells(ActiveCell.Row, "BJ").End(xlToLeft))
For Each cell In var
strbody = strbody & cell.Value & vbNewLine
Next






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
variable height variable width stacked bar charts ambthiru Charts and Charting in Excel 3 January 18th 06 11:41 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


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