Re: $$Excel-Macros$$ Open file using criteria from input box
No, it is not. Didn't think of it much to be considered offendable. But got your point. Won't refer to you in that form, Sir. I also realize that one should code 'efficiently'. In the interest of the forum decorum, I would like to take responsibility for the exchange of words that happened here which are not related to Excel help, and would like to close this here. S On Sep 12, 12:17 am, "dguillett1" wrote: > Your apology is accepted. You could have simply corrected my typo. As a > Microsoft Excel MVP, I do try to help others learn to code “efficiently”. > BTW, my name is not D. Is yours S? > > From: Sam Mathai Chacko > Sent: Sunday, September 11, 2011 4:12 PM > To: excel-macros@googlegroups.com > Subject: Re: $$Excel-Macros$$ Open file using criteria from input box > > D, to be honest, that was certainly not to offend you. If you felt so, my > sincere apologies. I thought it was strange to have a solution posted when > one was already posted. > > Once again, please accept my apologies. You are a valuable contributor, and > we need you here. > > Mods, I would still be interested to know why D wasn't able to see my post > before he posted. > > Regards, > > Sam > > On Mon, Sep 12, 2011 at 12:09 AM, dguillett1 wrote: > > If I am to assume that D is referring to me, then I made a small typo and I > did not see the other answer. > If my contributions are to this group unwelcome then I have better things > to do. GEEZ!!! > > Sub OpenFile() > Workbooks.Open Filename:= _ > "C:\Users\user\Desktop\2011_" & InputBox("Vnesi nalog") & ".xlsx" > End Sub > From: Sam Mathai Chacko > Sent: Sunday, September 11, 2011 3:55 PM > To: excel-macros@googlegroups.com > Subject: Re: $$Excel-Macros$$ Open file using criteria from input box > > Solution already posted D. Could you confirm this was not visible in the > forum? If so, then I'd like the moderators to please check why other members > are not able to see solutions or answers that are already posted, and waste > their development time. > > Also D, please test the code before posting. > > Seba, > > Sub OpenFile() > Dim File As String > File = InputBox("Vnesi nalog") > If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 > Then > Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File > & ".xlsx" > Else > MsgBox "File does not exists!" > End If > End Sub > > On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: > > try > > Sub OpenFile() > Workbooks.Open Filename:= _ > "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" > End Sub > > > > -Original Message- From: Seba > Sent: Sunday, September 11, 2011 3:31 PM > To: MS EXCEL AND VBA MACROS > Subject: $$Excel-Macros$$ Open file using criteria from input box > > Hi all, > > I need help tweaking one of my simple macros. I would like to open a > file after I enter a value into a input box. I have files stored in a > specific folder and each one is named like "year_sequence_number", ie: > 2011_001. I need a macro which would open a file based on a value I > enter. For example: I enter the value 123 and I get the file 2011_123 > opened. > > First I wrote this using my basic knowledge: > > > ---- > Sub OpenFile() > Dim File As Integer > > File = InputBox("Vnesi nalog") > > If File = 001 Then > > Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx" > > Else > > Exit Sub > > End If > > End Sub > > ---- > > Now is it possible and how to modify this so I wouldn't have to copy > and paste this a thousand times:) > And if possible, I would only like to enter the last three digits as a > value: just 001 and not the full name 2011_001. > > Thank you and best regards, > seba > > -- > > ------ > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links > :http://twitter.com/exceldailytip > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
Re: $$Excel-Macros$$ Open file using criteria from input box
Your apology is accepted. You could have simply corrected my typo. As a Microsoft Excel MVP, I do try to help others learn to code “efficiently”. BTW, my name is not D. Is yours S? From: Sam Mathai Chacko Sent: Sunday, September 11, 2011 4:12 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Open file using criteria from input box D, to be honest, that was certainly not to offend you. If you felt so, my sincere apologies. I thought it was strange to have a solution posted when one was already posted. Once again, please accept my apologies. You are a valuable contributor, and we need you here. Mods, I would still be interested to know why D wasn't able to see my post before he posted. Regards, Sam On Mon, Sep 12, 2011 at 12:09 AM, dguillett1 wrote: If I am to assume that D is referring to me, then I made a small typo and I did not see the other answer. If my contributions are to this group unwelcome then I have better things to do. GEEZ!!! Sub OpenFile() Workbooks.Open Filename:= _ "C:\Users\user\Desktop\2011_" & InputBox("Vnesi nalog") & ".xlsx" End Sub From: Sam Mathai Chacko Sent: Sunday, September 11, 2011 3:55 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Open file using criteria from input box Solution already posted D. Could you confirm this was not visible in the forum? If so, then I'd like the moderators to please check why other members are not able to see solutions or answers that are already posted, and waste their development time. Also D, please test the code before posting. Seba, Sub OpenFile() Dim File As String File = InputBox("Vnesi nalog") If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File & ".xlsx" Else MsgBox "File does not exists!" End If End Sub On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: try Sub OpenFile() Workbooks.Open Filename:= _ "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" End Sub -Original Message- From: Seba Sent: Sunday, September 11, 2011 3:31 PM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Open file using criteria from input box Hi all, I need help tweaking one of my simple macros. I would like to open a file after I enter a value into a input box. I have files stored in a specific folder and each one is named like "year_sequence_number", ie: 2011_001. I need a macro which would open a file based on a value I enter. For example: I enter the value 123 and I get the file 2011_123 opened. First I wrote this using my basic knowledge: Sub OpenFile() Dim File As Integer File = InputBox("Vnesi nalog") If File = 001 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx" Else Exit Sub End If End Sub Now is it possible and how to modify this so I wouldn't have to copy and paste this a thousand times:) And if possible, I would only like to enter the last three digits as a value: just 001 and not the full name 2011_001. Thank you and best regards, seba -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quic
Re: $$Excel-Macros$$ Open file using criteria from input box
D, to be honest, that was certainly not to offend you. If you felt so, my sincere apologies. I thought it was strange to have a solution posted when one was already posted. Once again, please accept my apologies. You are a valuable contributor, and we need you here. Mods, I would still be interested to know why D wasn't able to see my post before he posted. Regards, Sam On Mon, Sep 12, 2011 at 12:09 AM, dguillett1 wrote: >If I am to assume that D is referring to me, then I made a small typo > and I did not see the other answer. > If my contributions are to this group unwelcome then I have better things > to do. GEEZ!!! > > Sub OpenFile() > Workbooks.Open Filename:= _ > "C:\Users\user\Desktop\2011_" & InputBox("Vnesi nalog") & ".xlsx" > End Sub > *From:* Sam Mathai Chacko > *Sent:* Sunday, September 11, 2011 3:55 PM > *To:* excel-macros@googlegroups.com > *Subject:* Re: $$Excel-Macros$$ Open file using criteria from input box > > Solution already posted D. Could you confirm this was not visible in the > forum? If so, then I'd like the moderators to please check why other members > are not able to see solutions or answers that are already posted, and waste > their development time. > > Also D, please test the code before posting. > > Seba, > > Sub OpenFile() >Dim File As String >File = InputBox("Vnesi nalog") >If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 > Then >Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File > & ".xlsx" >Else >MsgBox "File does not exists!" >End If > End Sub > > On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: > >> try >> >> Sub OpenFile() >> Workbooks.Open Filename:= _ >> "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" >> End Sub >> >> -Original Message- From: Seba >> Sent: Sunday, September 11, 2011 3:31 PM >> To: MS EXCEL AND VBA MACROS >> Subject: $$Excel-Macros$$ Open file using criteria from input box >> >> >> Hi all, >> >> I need help tweaking one of my simple macros. I would like to open a >> file after I enter a value into a input box. I have files stored in a >> specific folder and each one is named like "year_sequence_number", ie: >> 2011_001. I need a macro which would open a file based on a value I >> enter. For example: I enter the value 123 and I get the file 2011_123 >> opened. >> >> First I wrote this using my basic knowledge: >> >> --**--** >> --**-- >> Sub OpenFile() >> Dim File As Integer >> >> File = InputBox("Vnesi nalog") >> >> If File = 001 Then >> >> Workbooks.Open Filename:="C:\Users\user\**Desktop\2011_001.xlsx" >> >> Else >> >> Exit Sub >> >> End If >> >> >> End Sub >> --**--** >> --**-- >> >> Now is it possible and how to modify this so I wouldn't have to copy >> and paste this a thousand times:) >> And if possible, I would only like to enter the last three digits as a >> value: just 001 and not the full name 2011_001. >> >> Thank you and best regards, >> seba >> >> -- >> --**--** >> -- >> Some important links for excel users: >> 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/** >> exceldailytip <http://twitter.com/exceldailytip> >> 2. Join our LinkedIN group @ >> http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> >> 3. Excel tutorials at >> http://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> >> 4. Learn VBA Macros at >> http://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> >> 5. Excel Tips and Tricks at >> http://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> >> >> To post to this group, send email to excel-macros@googlegroups.com >> >> <><><><><><><><><><><><><><><>**<><><><><><><> >> Like our page on facebook , Just follow below link >> http://www.facebook.com/**discu
Re: $$Excel-Macros$$ Open file using criteria from input box
If I am to assume that D is referring to me, then I made a small typo and I did not see the other answer. If my contributions are to this group unwelcome then I have better things to do. GEEZ!!! Sub OpenFile() Workbooks.Open Filename:= _ "C:\Users\user\Desktop\2011_" & InputBox("Vnesi nalog") & ".xlsx" End Sub From: Sam Mathai Chacko Sent: Sunday, September 11, 2011 3:55 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Open file using criteria from input box Solution already posted D. Could you confirm this was not visible in the forum? If so, then I'd like the moderators to please check why other members are not able to see solutions or answers that are already posted, and waste their development time. Also D, please test the code before posting. Seba, Sub OpenFile() Dim File As String File = InputBox("Vnesi nalog") If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File & ".xlsx" Else MsgBox "File does not exists!" End If End Sub On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: try Sub OpenFile() Workbooks.Open Filename:= _ "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" End Sub -Original Message- From: Seba Sent: Sunday, September 11, 2011 3:31 PM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Open file using criteria from input box Hi all, I need help tweaking one of my simple macros. I would like to open a file after I enter a value into a input box. I have files stored in a specific folder and each one is named like "year_sequence_number", ie: 2011_001. I need a macro which would open a file based on a value I enter. For example: I enter the value 123 and I get the file 2011_123 opened. First I wrote this using my basic knowledge: Sub OpenFile() Dim File As Integer File = InputBox("Vnesi nalog") If File = 001 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx" Else Exit Sub End If End Sub Now is it possible and how to modify this so I wouldn't have to copy and paste this a thousand times:) And if possible, I would only like to enter the last three digits as a value: just 001 and not the full name 2011_001. Thank you and best regards, seba -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- Sam Mathai Chacko -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><&
Re: $$Excel-Macros$$ Open file using criteria from input box
Hi, I should have written thank you both! regards, seba On 11 sep., 23:04, Seba wrote: > Sam, thank you very much for your help and efforts. > > Works like a charm. You just made my monday easier:) > > regards, > seba > > On 11 sep., 22:55, Sam Mathai Chacko wrote: > > > > > > > > > Solution already posted D. Could you confirm this was not visible in the > > forum? If so, then I'd like the moderators to please check why other members > > are not able to see solutions or answers that are already posted, and waste > > their development time. > > > Also D, please test the code before posting. > > > Seba, > > > Sub OpenFile() > > Dim File As String > > File = InputBox("Vnesi nalog") > > If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 > > Then > > Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File > > & ".xlsx" > > Else > > MsgBox "File does not exists!" > > End If > > End Sub > > > On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: > > > try > > > > Sub OpenFile() > > > Workbooks.Open Filename:= _ > > > "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" > > > End Sub > > > > -Original Message- From: Seba > > > Sent: Sunday, September 11, 2011 3:31 PM > > > To: MS EXCEL AND VBA MACROS > > > Subject: $$Excel-Macros$$ Open file using criteria from input box > > > > Hi all, > > > > I need help tweaking one of my simple macros. I would like to open a > > > file after I enter a value into a input box. I have files stored in a > > > specific folder and each one is named like "year_sequence_number", ie: > > > 2011_001. I need a macro which would open a file based on a value I > > > enter. For example: I enter the value 123 and I get the file 2011_123 > > > opened. > > > > First I wrote this using my basic knowledge: > > > > --**--** > > > --**-- > > > Sub OpenFile() > > > Dim File As Integer > > > > File = InputBox("Vnesi nalog") > > > > If File = 001 Then > > > > Workbooks.Open Filename:="C:\Users\user\**Desktop\2011_001.xlsx" > > > > Else > > > > Exit Sub > > > > End If > > > > End Sub > > > --**--** > > > --**-- > > > > Now is it possible and how to modify this so I wouldn't have to copy > > > and paste this a thousand times:) > > > And if possible, I would only like to enter the last three digits as a > > > value: just 001 and not the full name 2011_001. > > > > Thank you and best regards, > > > seba > > > > -- > > > --**--** > > > -- > > > Some important links for excel users: > > > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/** > > > exceldailytip <http://twitter.com/exceldailytip> > > > 2. Join our LinkedIN group > > > @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> > > > 3. Excel tutorials > > > athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> > > > 4. Learn VBA Macros > > > athttp://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> > > > 5. Excel Tips and Tricks > > > athttp://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> > > > > To post to this group, send email to excel-macros@googlegroups.com > > > > <><><><><><><><><><><><><><><>**<><><><><><><> > > > Like our page on facebook , Just follow below link > > >http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel> > > > -- > > > --**--** > > > -- > > > Some important links for excel users: > > > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/** > > > exceldailytip <http://twitter.com/exceldailytip> > > &g
Re: $$Excel-Macros$$ Open file using criteria from input box
Sam, thank you very much for your help and efforts. Works like a charm. You just made my monday easier:) regards, seba On 11 sep., 22:55, Sam Mathai Chacko wrote: > Solution already posted D. Could you confirm this was not visible in the > forum? If so, then I'd like the moderators to please check why other members > are not able to see solutions or answers that are already posted, and waste > their development time. > > Also D, please test the code before posting. > > Seba, > > Sub OpenFile() > Dim File As String > File = InputBox("Vnesi nalog") > If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 > Then > Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File > & ".xlsx" > Else > MsgBox "File does not exists!" > End If > End Sub > > > > > > > > > > On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: > > try > > > Sub OpenFile() > > Workbooks.Open Filename:= _ > > "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" > > End Sub > > > -Original Message- From: Seba > > Sent: Sunday, September 11, 2011 3:31 PM > > To: MS EXCEL AND VBA MACROS > > Subject: $$Excel-Macros$$ Open file using criteria from input box > > > Hi all, > > > I need help tweaking one of my simple macros. I would like to open a > > file after I enter a value into a input box. I have files stored in a > > specific folder and each one is named like "year_sequence_number", ie: > > 2011_001. I need a macro which would open a file based on a value I > > enter. For example: I enter the value 123 and I get the file 2011_123 > > opened. > > > First I wrote this using my basic knowledge: > > > --**--** > > --**-- > > Sub OpenFile() > > Dim File As Integer > > > File = InputBox("Vnesi nalog") > > > If File = 001 Then > > > Workbooks.Open Filename:="C:\Users\user\**Desktop\2011_001.xlsx" > > > Else > > > Exit Sub > > > End If > > > End Sub > > --**--** > > --**-- > > > Now is it possible and how to modify this so I wouldn't have to copy > > and paste this a thousand times:) > > And if possible, I would only like to enter the last three digits as a > > value: just 001 and not the full name 2011_001. > > > Thank you and best regards, > > seba > > > -- > > --**--** > > -- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/** > > exceldailytip <http://twitter.com/exceldailytip> > > 2. Join our LinkedIN group > > @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> > > 3. Excel tutorials > > athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> > > 4. Learn VBA Macros > > athttp://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> > > 5. Excel Tips and Tricks > > athttp://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><>**<><><><><><><> > > Like our page on facebook , Just follow below link > >http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel> > > -- > > --**--** > > -- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/** > > exceldailytip <http://twitter.com/exceldailytip> > > 2. Join our LinkedIN group > > @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> > > 3. Excel tutorials > > athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> > > 4. Learn VBA Macros > > athttp://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> > > 5. Excel Tips and Tricks > > athttp://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> > >
Re: $$Excel-Macros$$ Open file using criteria from input box
Solution already posted D. Could you confirm this was not visible in the forum? If so, then I'd like the moderators to please check why other members are not able to see solutions or answers that are already posted, and waste their development time. Also D, please test the code before posting. Seba, Sub OpenFile() Dim File As String File = InputBox("Vnesi nalog") If Len(Dir("C:\Users\user\Desktop\2011_" & File & ".xlsx")) <> 0 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_" & File & ".xlsx" Else MsgBox "File does not exists!" End If End Sub On Sun, Sep 11, 2011 at 11:51 PM, dguillett1 wrote: > try > > Sub OpenFile() > Workbooks.Open Filename:= _ > "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" > End Sub > > -----Original Message----- From: Seba > Sent: Sunday, September 11, 2011 3:31 PM > To: MS EXCEL AND VBA MACROS > Subject: $$Excel-Macros$$ Open file using criteria from input box > > > Hi all, > > I need help tweaking one of my simple macros. I would like to open a > file after I enter a value into a input box. I have files stored in a > specific folder and each one is named like "year_sequence_number", ie: > 2011_001. I need a macro which would open a file based on a value I > enter. For example: I enter the value 123 and I get the file 2011_123 > opened. > > First I wrote this using my basic knowledge: > > --**--** > --**-- > Sub OpenFile() > Dim File As Integer > > File = InputBox("Vnesi nalog") > > If File = 001 Then > > Workbooks.Open Filename:="C:\Users\user\**Desktop\2011_001.xlsx" > > Else > > Exit Sub > > End If > > > End Sub > --**--** > --**-- > > Now is it possible and how to modify this so I wouldn't have to copy > and paste this a thousand times:) > And if possible, I would only like to enter the last three digits as a > value: just 001 and not the full name 2011_001. > > Thank you and best regards, > seba > > -- > --**--** > -- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/** > exceldailytip <http://twitter.com/exceldailytip> > 2. Join our LinkedIN group @ > http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> > 3. Excel tutorials at > http://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> > 4. Learn VBA Macros at > http://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> > 5. Excel Tips and Tricks at > http://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><>**<><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel> > -- > --**--** > -- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/** > exceldailytip <http://twitter.com/exceldailytip> > 2. Join our LinkedIN group @ > http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310> > 3. Excel tutorials at > http://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com/> > 4. Learn VBA Macros at > http://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com/> > 5. Excel Tips and Tricks at > http://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com/> > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><>**<><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel> > -- Sam Mathai Chacko -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
Re: $$Excel-Macros$$ Open file using criteria from input box
try Sub OpenFile() Workbooks.Open Filename:= _ "C:\Users\user\Desktop\2011_" InputBox("Vnesi nalog")&".xlsx" End Sub -Original Message- From: Seba Sent: Sunday, September 11, 2011 3:31 PM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Open file using criteria from input box Hi all, I need help tweaking one of my simple macros. I would like to open a file after I enter a value into a input box. I have files stored in a specific folder and each one is named like "year_sequence_number", ie: 2011_001. I need a macro which would open a file based on a value I enter. For example: I enter the value 123 and I get the file 2011_123 opened. First I wrote this using my basic knowledge: Sub OpenFile() Dim File As Integer File = InputBox("Vnesi nalog") If File = 001 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx" Else Exit Sub End If End Sub Now is it possible and how to modify this so I wouldn't have to copy and paste this a thousand times:) And if possible, I would only like to enter the last three digits as a value: just 001 and not the full name 2011_001. Thank you and best regards, seba -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
$$Excel-Macros$$ Open file using criteria from input box
Hi all, I need help tweaking one of my simple macros. I would like to open a file after I enter a value into a input box. I have files stored in a specific folder and each one is named like "year_sequence_number", ie: 2011_001. I need a macro which would open a file based on a value I enter. For example: I enter the value 123 and I get the file 2011_123 opened. First I wrote this using my basic knowledge: Sub OpenFile() Dim File As Integer File = InputBox("Vnesi nalog") If File = 001 Then Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx" Else Exit Sub End If End Sub Now is it possible and how to modify this so I wouldn't have to copy and paste this a thousand times:) And if possible, I would only like to enter the last three digits as a value: just 001 and not the full name 2011_001. Thank you and best regards, seba -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel