Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default comment enclosed using vlookup

Hi,

I'm using vlookup array, which is source link has comment in every single
cell.
and I would like if comment attached from source also will be enclosed in my
summary. Is there any way to do so?

Appreciate for any help.

Pran
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default comment enclosed using vlookup

Hi Pran

There is no built-in functionality to do that. You can try the below UDF
(User Defined function).

Syntax:
=VLOOKUP_COMMENT(strLookupValue,rngLookUpArray,int Column)

rngLookUpArray is the Lookuprange
strLookupValue is the lookup string or cell reference
intColumn is the column to be concatenated


Examples:
'1. To vlookup 1 in col A and return value from Column C. If comments are
present for Col C the function will return the comments to the formula cell.

=VLOOKUP_COMMENT(1,A:C,3)

OR

'with the lookup value in cell D1
=VLOOKUP_COMMENT(D1,A:C,3)


Below is the code to be pasted to the code module. From workbook launch VBE
using Alt+F11. From menu Insert a Module and paste the below function.Close
and get back to workbook and try the formula.


Function VLOOKUP_COMMENT(strLookupValue As String, _
rngLookUpArray As Range, intColumn As Integer)
Dim lngRow As Long, rngTemp As Range
For lngRow = 1 To rngLookUpArray.Rows.Count
If CStr(rngLookUpArray(lngRow, 1)) = strLookupValue Then _
VLOOKUP_COMMENT = rngLookUpArray(lngRow, intColumn): Exit For
Next

Set rngTemp = Application.Caller
If Not rngTemp.Comment Is Nothing Then rngTemp.Comment.Delete
If Not rngLookUpArray(lngRow, intColumn).Comment Is Nothing Then
rngTemp.AddComment rngLookUpArray(lngRow, intColumn).Comment.Text
End If
End Function


If this post helps click Yes
---------------
Jacob Skaria


"Pran" wrote:

Hi,

I'm using vlookup array, which is source link has comment in every single
cell.
and I would like if comment attached from source also will be enclosed in my
summary. Is there any way to do so?

Appreciate for any help.

Pran

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default comment enclosed using vlookup

Jacob,

Many thx cause it works! it simplify my job...
Thx for the VBA module

Kind Regards,

"Jacob Skaria" wrote:

Hi Pran

There is no built-in functionality to do that. You can try the below UDF
(User Defined function).

Syntax:
=VLOOKUP_COMMENT(strLookupValue,rngLookUpArray,int Column)

rngLookUpArray is the Lookuprange
strLookupValue is the lookup string or cell reference
intColumn is the column to be concatenated


Examples:
'1. To vlookup 1 in col A and return value from Column C. If comments are
present for Col C the function will return the comments to the formula cell.

=VLOOKUP_COMMENT(1,A:C,3)

OR

'with the lookup value in cell D1
=VLOOKUP_COMMENT(D1,A:C,3)


Below is the code to be pasted to the code module. From workbook launch VBE
using Alt+F11. From menu Insert a Module and paste the below function.Close
and get back to workbook and try the formula.


Function VLOOKUP_COMMENT(strLookupValue As String, _
rngLookUpArray As Range, intColumn As Integer)
Dim lngRow As Long, rngTemp As Range
For lngRow = 1 To rngLookUpArray.Rows.Count
If CStr(rngLookUpArray(lngRow, 1)) = strLookupValue Then _
VLOOKUP_COMMENT = rngLookUpArray(lngRow, intColumn): Exit For
Next

Set rngTemp = Application.Caller
If Not rngTemp.Comment Is Nothing Then rngTemp.Comment.Delete
If Not rngLookUpArray(lngRow, intColumn).Comment Is Nothing Then
rngTemp.AddComment rngLookUpArray(lngRow, intColumn).Comment.Text
End If
End Function


If this post helps click Yes
---------------
Jacob Skaria


"Pran" wrote:

Hi,

I'm using vlookup array, which is source link has comment in every single
cell.
and I would like if comment attached from source also will be enclosed in my
summary. Is there any way to do so?

Appreciate for any help.

Pran

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
Transfer Comment to VLOOKUP Cell on Search CCorreia Excel Discussion (Misc queries) 3 May 23rd 08 01:57 AM
How to show original comment in cell when using Vlookup in Excel? Lucy Excel Worksheet Functions 3 January 17th 08 05:34 AM
Vlookup while pulling a cell color and comment wendy Excel Worksheet Functions 1 April 19th 06 06:13 PM
Please help with enclosed schedule of duty Huawei Excel Worksheet Functions 10 January 13th 06 02:46 PM
How do I export a csv file from Excel with fields enclosed in dou. mk_webman Excel Discussion (Misc queries) 2 December 24th 04 02:39 PM


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