Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Help with getting Values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Abode - 22 Mar 2006 23:32 GMT
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
Gary''s Student - 23 Mar 2006 00:56 GMT
If you are trying to check the value in a cell then instead of :
Application.Indirect("Y" & RowNum)
try:
Range("Y"& RowNun).Value
Signature

Gary's Student

> 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
[quoted text clipped - 23 lines]
>
> Mark
Abode - 23 Mar 2006 01:56 GMT
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.

> If you are trying to check the value in a cell then instead of :
> Application.Indirect("Y" & RowNum)
[quoted text clipped - 28 lines]
> >
> > Mark
Gary''s Student - 23 Mar 2006 03:44 GMT
You are very welcome.
Signature

Gary's Student

> 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.
[quoted text clipped - 31 lines]
> > >
> > > Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.