PC Review


Reply
Thread Tools Rate Thread

How to change data in a formula

 
 
etradeguru@hotmail.com
Guest
Posts: n/a
 
      6th Sep 2007
Here is s snip of the code that I want to be able to enter a variable
into via a Input Box for the user to enter.

The piece I want to enter is the 20070904log.xls bit as this changes
on a daily basis.

ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
\Logs\20070904Log.xls'!DirName,1,FALSE)),""This is a new or modified
Dir "",""Not a new Dir"")"

So any (polite!) suggestions would be welcome.

Thank you

Mark

 
Reply With Quote
 
 
 
 
=?Utf-8?B?YmFybmFiZWw=?=
Guest
Posts: n/a
 
      6th Sep 2007
dim fName as string

fname = InputBox("Please enter the filename", "File Name", "log.xls")
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
\Logs\" & fname & "'!DirName,1,FALSE)),""This is a new or modified
Dir "",""Not a new Dir"")"

This does not do anything to check that what they entered is valid.

Peter Richardson
"(E-Mail Removed)" wrote:

> Here is s snip of the code that I want to be able to enter a variable
> into via a Input Box for the user to enter.
>
> The piece I want to enter is the 20070904log.xls bit as this changes
> on a daily basis.
>
> ActiveCell.FormulaR1C1 = _
> "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> \Logs\20070904Log.xls'!DirName,1,FALSE)),""This is a new or modified
> Dir "",""Not a new Dir"")"
>
> So any (polite!) suggestions would be welcome.
>
> Thank you
>
> Mark
>
>

 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      6th Sep 2007
Dim fInput As String
fInput = InputBox("Enter the file name", "Title Here")
If fInput = "" Or fInput = False Then Exit Sub
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
\Logs\" & fInput & ".xls'!DirName,1,FALSE)),""This is a new or
modified Dir "",""Not a new Dir"")"

etradeg...@hotmail.com wrote:
> Here is s snip of the code that I want to be able to enter a variable
> into via a Input Box for the user to enter.
>
> The piece I want to enter is the 20070904log.xls bit as this changes
> on a daily basis.
>
> ActiveCell.FormulaR1C1 = _
> "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> \Logs\20070904Log.xls'!DirName,1,FALSE)),""This is a new or modified
> Dir "",""Not a new Dir"")"
>
> So any (polite!) suggestions would be welcome.
>
> Thank you
>
> Mark


 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      6th Sep 2007
ACK! Peter beat me to it.

-Jeff-
JW wrote:
> Dim fInput As String
> fInput = InputBox("Enter the file name", "Title Here")
> If fInput = "" Or fInput = False Then Exit Sub
> ActiveCell.FormulaR1C1 = _
> "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> \Logs\" & fInput & ".xls'!DirName,1,FALSE)),""This is a new or
> modified Dir "",""Not a new Dir"")"
>
> etradeg...@hotmail.com wrote:
> > Here is s snip of the code that I want to be able to enter a variable
> > into via a Input Box for the user to enter.
> >
> > The piece I want to enter is the 20070904log.xls bit as this changes
> > on a daily basis.
> >
> > ActiveCell.FormulaR1C1 = _
> > "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> > \Logs\20070904Log.xls'!DirName,1,FALSE)),""This is a new or modified
> > Dir "",""Not a new Dir"")"
> >
> > So any (polite!) suggestions would be welcome.
> >
> > Thank you
> >
> > Mark


 
Reply With Quote
 
WhatUp
Guest
Posts: n/a
 
      6th Sep 2007
Thanks a ton!

 
Reply With Quote
 
=?Utf-8?B?YmFybmFiZWw=?=
Guest
Posts: n/a
 
      6th Sep 2007
only by a couple minutes. That's the time it took you to add the check of
the input .

"JW" wrote:

> ACK! Peter beat me to it.
>
> -Jeff-
> JW wrote:
> > Dim fInput As String
> > fInput = InputBox("Enter the file name", "Title Here")
> > If fInput = "" Or fInput = False Then Exit Sub
> > ActiveCell.FormulaR1C1 = _
> > "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> > \Logs\" & fInput & ".xls'!DirName,1,FALSE)),""This is a new or
> > modified Dir "",""Not a new Dir"")"
> >
> > etradeg...@hotmail.com wrote:
> > > Here is s snip of the code that I want to be able to enter a variable
> > > into via a Input Box for the user to enter.
> > >
> > > The piece I want to enter is the 20070904log.xls bit as this changes
> > > on a daily basis.
> > >
> > > ActiveCell.FormulaR1C1 = _
> > > "=IF(ISNA(VLOOKUP(RC[-8],'N:\1._Document_Version_Control_Log
> > > \Logs\20070904Log.xls'!DirName,1,FALSE)),""This is a new or modified
> > > Dir "",""Not a new Dir"")"
> > >
> > > So any (polite!) suggestions would be welcome.
> > >
> > > Thank you
> > >
> > > Mark

>
>

 
Reply With Quote
 
Bill Renaud
Guest
Posts: n/a
 
      7th Sep 2007
You could also try the following technique to get the filename (I prefer
this method, as it eliminates having to check the validity of the
filename):

Dim strFileName As String

strFileName = Application.GetOpenFilename(FileFilter:="Excel Files
(*.xls),*.xls", _
Title:="Select Document
Version Control Log")

This only gets the file name without actually opening the file. Just
remember that the value of strFileName will be "False" if the user
cancels out of the dialog box.
--
Regards,
Bill Renaud



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
At each change in data apply formula Shon Microsoft Excel Programming 4 11th Dec 2009 03:51 PM
Formula for change background according to data shallowz Microsoft Excel Misc 4 6th Jan 2009 04:18 PM
How does Data Validation change with a formula change? =?Utf-8?B?TWF5Q2xhcmtPcmlnaW5hbHM=?= Microsoft Excel Worksheet Functions 3 5th Jul 2006 04:50 AM
Change Data in columns but keep the formula can I do this? rition@hotmail.com Microsoft Excel Discussion 0 9th Feb 2006 03:26 PM
How do change formula to permanent data? =?Utf-8?B?V2VuZHJvbiBHb3Jkb24=?= Microsoft Excel Misc 3 3rd May 2005 05:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:48 PM.