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

I'm not that good with VBA, so I was wondering if someone could help write a
function. Essentially I have a spreadsheet where the columns represent
various forms, tests, etc. that we track for new hires. Unfortunately, there
is no easy way to see all of the missing documentation. My thought is to
write a function that takes in a range of rows (e.g., b50:f50) , checks to
see if there is a value in the first cell, if there is, move to the next
cell, if there isn't write "Missing" and the column header (e.g., b1) and
then move to next cell in the range, perform the same check and concatenate
the return string. This would make the output a text string that would read
something like: "Missing B, Missing D, Missing E". Can anyone recommend an
approach I could try? Thanks in advance for your assistance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Function Help

Sub CheckDate()
Dim rng as Range, cell as Range
Dim sStr as String
set rng = Range(cells(activecell.row,"B"),cells(activecell.r ow,"F"))
for each cell in rng
if isempty(cell) then
sStr = cells(1,cell.Column) & ", "
end if
Next
sStr = left(sStr,len(sStr)-2)
msgbox sStr
end sub

--
Regards,
Tom Ogilvy



"Matt Gehrmann" wrote in message
...
I'm not that good with VBA, so I was wondering if someone could help write

a
function. Essentially I have a spreadsheet where the columns represent
various forms, tests, etc. that we track for new hires. Unfortunately,

there
is no easy way to see all of the missing documentation. My thought is to
write a function that takes in a range of rows (e.g., b50:f50) , checks to
see if there is a value in the first cell, if there is, move to the next
cell, if there isn't write "Missing" and the column header (e.g., b1) and
then move to next cell in the range, perform the same check and

concatenate
the return string. This would make the output a text string that would

read
something like: "Missing B, Missing D, Missing E". Can anyone recommend

an
approach I could try? Thanks in advance for your assistance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Function Help

Tom,

This is great, thanks for the help. Unfortunately, I have another stupid
question. Since I have many rows of data that I need to check, how can I get
the output to be in the last column? For example, assuming we were somewhere
in row 50 of the spreadsheet, is there a way to write this as a function that
would be more like =CheckDate(b50:f50) which would return Missing B, Missing
C? This way I could copy it down to examine all of the rows of data I have.
If this is not possible, could you recommend something that might work?
Thanks again, I appreciate it.

Matt

"Tom Ogilvy" wrote:

Sub CheckDate()
Dim rng as Range, cell as Range
Dim sStr as String
set rng = Range(cells(activecell.row,"B"),cells(activecell.r ow,"F"))
for each cell in rng
if isempty(cell) then
sStr = cells(1,cell.Column) & ", "
end if
Next
sStr = left(sStr,len(sStr)-2)
msgbox sStr
end sub

--
Regards,
Tom Ogilvy



"Matt Gehrmann" wrote in message
...
I'm not that good with VBA, so I was wondering if someone could help write

a
function. Essentially I have a spreadsheet where the columns represent
various forms, tests, etc. that we track for new hires. Unfortunately,

there
is no easy way to see all of the missing documentation. My thought is to
write a function that takes in a range of rows (e.g., b50:f50) , checks to
see if there is a value in the first cell, if there is, move to the next
cell, if there isn't write "Missing" and the column header (e.g., b1) and
then move to next cell in the range, perform the same check and

concatenate
the return string. This would make the output a text string that would

read
something like: "Missing B, Missing D, Missing E". Can anyone recommend

an
approach I could try? Thanks in advance for your assistance!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Function Help

Hi Matt

Adapted from Tom's macro:

Function CheckDate(ChkRange As Range) As String
Dim cell As Range
For Each cell In ChkRange
If IsEmpty(cell) Then
CheckDate = CheckDate & "Missing " & _
Mid(cell.Address, 2, InStr(2, cell.Address, "$") - 2) _
& ", "
End If
Next
If CheckDate < "" Then
CheckDate = Left(CheckDate, Len(CheckDate) - 2)
Else
CheckDate = "Everything OK"
End If
End Function

Paste this into a standard module and then you will be able to use
=CheckDate(B50:F50) as a worksheet function.

Hope this helps
Rowan

Matt Gehrmann wrote:
Tom,

This is great, thanks for the help. Unfortunately, I have another stupid
question. Since I have many rows of data that I need to check, how can I get
the output to be in the last column? For example, assuming we were somewhere
in row 50 of the spreadsheet, is there a way to write this as a function that
would be more like =CheckDate(b50:f50) which would return Missing B, Missing
C? This way I could copy it down to examine all of the rows of data I have.
If this is not possible, could you recommend something that might work?
Thanks again, I appreciate it.

Matt

"Tom Ogilvy" wrote:


Sub CheckDate()
Dim rng as Range, cell as Range
Dim sStr as String
set rng = Range(cells(activecell.row,"B"),cells(activecell.r ow,"F"))
for each cell in rng
if isempty(cell) then
sStr = cells(1,cell.Column) & ", "
end if
Next
sStr = left(sStr,len(sStr)-2)
msgbox sStr
end sub

--
Regards,
Tom Ogilvy



"Matt Gehrmann" wrote in message
...

I'm not that good with VBA, so I was wondering if someone could help write


a

function. Essentially I have a spreadsheet where the columns represent
various forms, tests, etc. that we track for new hires. Unfortunately,


there

is no easy way to see all of the missing documentation. My thought is to
write a function that takes in a range of rows (e.g., b50:f50) , checks to
see if there is a value in the first cell, if there is, move to the next
cell, if there isn't write "Missing" and the column header (e.g., b1) and
then move to next cell in the range, perform the same check and


concatenate

the return string. This would make the output a text string that would


read

something like: "Missing B, Missing D, Missing E". Can anyone recommend


an

approach I could try? Thanks in advance for your assistance!




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
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 06:59 PM.

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"