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

Hello. I am trying to make a simple function that will automatically fill in
data if a few Cells are not blank. I'd very much like to do this with a
function but if need be I'll struggle with working with Sub Code. I am
trying to keep this very readable in Microsoft Excel and I'd really only like
to pass in two variables if it is posssable. My code thus far (which doesn't
work because I am guessing Application.Indirect doesn't work) is:

Function AutoFill(RowNum, TrueFill)
If (Application.Indirect("Y" & RowNum)) < "" Then
AutoFill = TrueFill
Else
If (Application.indirect("B" & RowNum) = "") And
(Application.indirect("B" & (RowNum + 1)) = "") Then
AutoFill = "---"
Else
AutoFill = ""
End If
End If
End Function

Where RowNum is the Row Number without the column letter and TrueFill is
what will be filled into the cell if the certain cells are not blank. I need
the program to check if columns B and Y are filled with something on that row
as well as Column B of the next row. If any of you know of some code that
will help me do this I will be very greatful. Thank you for your time.

Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Help with getting Values

If you are trying to check the value in a cell then instead of :
Application.Indirect("Y" & RowNum)
try:
Range("Y"& RowNun).Value
--
Gary's Student


"Abode" wrote:

Hello. I am trying to make a simple function that will automatically fill in
data if a few Cells are not blank. I'd very much like to do this with a
function but if need be I'll struggle with working with Sub Code. I am
trying to keep this very readable in Microsoft Excel and I'd really only like
to pass in two variables if it is posssable. My code thus far (which doesn't
work because I am guessing Application.Indirect doesn't work) is:

Function AutoFill(RowNum, TrueFill)
If (Application.Indirect("Y" & RowNum)) < "" Then
AutoFill = TrueFill
Else
If (Application.indirect("B" & RowNum) = "") And
(Application.indirect("B" & (RowNum + 1)) = "") Then
AutoFill = "---"
Else
AutoFill = ""
End If
End If
End Function

Where RowNum is the Row Number without the column letter and TrueFill is
what will be filled into the cell if the certain cells are not blank. I need
the program to check if columns B and Y are filled with something on that row
as well as Column B of the next row. If any of you know of some code that
will help me do this I will be very greatful. Thank you for your time.

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Help with getting Values

Thank you very much. That worked perfectly. Plus it led me to another
update in the code I probably would have asked help for anyway.

"Gary''s Student" wrote:

If you are trying to check the value in a cell then instead of :
Application.Indirect("Y" & RowNum)
try:
Range("Y"& RowNun).Value
--
Gary's Student


"Abode" wrote:

Hello. I am trying to make a simple function that will automatically fill in
data if a few Cells are not blank. I'd very much like to do this with a
function but if need be I'll struggle with working with Sub Code. I am
trying to keep this very readable in Microsoft Excel and I'd really only like
to pass in two variables if it is posssable. My code thus far (which doesn't
work because I am guessing Application.Indirect doesn't work) is:

Function AutoFill(RowNum, TrueFill)
If (Application.Indirect("Y" & RowNum)) < "" Then
AutoFill = TrueFill
Else
If (Application.indirect("B" & RowNum) = "") And
(Application.indirect("B" & (RowNum + 1)) = "") Then
AutoFill = "---"
Else
AutoFill = ""
End If
End If
End Function

Where RowNum is the Row Number without the column letter and TrueFill is
what will be filled into the cell if the certain cells are not blank. I need
the program to check if columns B and Y are filled with something on that row
as well as Column B of the next row. If any of you know of some code that
will help me do this I will be very greatful. Thank you for your time.

Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Help with getting Values

You are very welcome.
--
Gary's Student


"Abode" wrote:

Thank you very much. That worked perfectly. Plus it led me to another
update in the code I probably would have asked help for anyway.

"Gary''s Student" wrote:

If you are trying to check the value in a cell then instead of :
Application.Indirect("Y" & RowNum)
try:
Range("Y"& RowNun).Value
--
Gary's Student


"Abode" wrote:

Hello. I am trying to make a simple function that will automatically fill in
data if a few Cells are not blank. I'd very much like to do this with a
function but if need be I'll struggle with working with Sub Code. I am
trying to keep this very readable in Microsoft Excel and I'd really only like
to pass in two variables if it is posssable. My code thus far (which doesn't
work because I am guessing Application.Indirect doesn't work) is:

Function AutoFill(RowNum, TrueFill)
If (Application.Indirect("Y" & RowNum)) < "" Then
AutoFill = TrueFill
Else
If (Application.indirect("B" & RowNum) = "") And
(Application.indirect("B" & (RowNum + 1)) = "") Then
AutoFill = "---"
Else
AutoFill = ""
End If
End If
End Function

Where RowNum is the Row Number without the column letter and TrueFill is
what will be filled into the cell if the certain cells are not blank. I need
the program to check if columns B and Y are filled with something on that row
as well as Column B of the next row. If any of you know of some code that
will help me do this I will be very greatful. Thank you for your time.

Mark

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
Excel 2007 doesnt show Y-axis values when the values are small. outback Charts and Charting in Excel 2 October 26th 08 01:37 AM
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 9th 08 03:07 AM
Search/Filter to find values in another range based on two cell values Andy Excel Programming 2 April 29th 04 04:08 PM
How do I search thr'o column and put unique values in differnt sheet and sum corresponding values in test test Excel Programming 3 September 9th 03 08:53 PM
Predict Y-values on new X-values based on other actual X and Y values? NorTor Excel Programming 2 August 10th 03 03:08 PM


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