PC Review


Reply
Thread Tools Rate Thread

Add to Dynamic Named Range

 
 
Steve
Guest
Posts: n/a
 
      27th Jan 2012
Hi all. I have a dynamic named range in Sheet1 A2:A100. I would like
to call a macro to pop an input box asking for a new value, and then
write that value in the next available cell in my named range. Any
idea how I can accomplish this?

Thanks!
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      27th Jan 2012
You don't need a named range for this

Sub msgboxvaluetonextrowSAS()
Dim ans As String
ans = InputBox("Enter Value", vbOKCancel)
Cells(2, "a").End(xlDown).Offset(1) = ans
End Sub


On Jan 27, 1:49*pm, Steve <steve_andrus...@yahoo.com> wrote:
> Hi all. *I have a dynamic named range in Sheet1 A2:A100. *I would like
> to call a macro to pop an input box asking for a new value, and then
> write that value in the next available cell in my named range. *Any
> idea how I can accomplish this?
>
> Thanks!


 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Jan 2012
Thanks Don!

One follow up question - is there a way to NOT allow the user to enter
the words "request" or "issue" in the string, displaying an error if
they do?

On Jan 27, 1:21*pm, Don Guillett <dguille...@gmail.com> wrote:
> You don't need a named range for this
>
> Sub msgboxvaluetonextrowSAS()
> Dim ans As String
> ans = InputBox("Enter Value", vbOKCancel)
> Cells(2, "a").End(xlDown).Offset(1) = ans
> End Sub
>
> On Jan 27, 1:49*pm, Steve <steve_andrus...@yahoo.com> wrote:
>
>
>
> > Hi all. *I have a dynamic named range in Sheet1 A2:A100. *I would like
> > to call a macro to pop an input box asking for a new value, and then
> > write that value in the next available cell in my named range. *Any
> > idea how I can accomplish this?

>
> > Thanks!- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      27th Jan 2012
On Jan 27, 3:08*pm, Steve <steve_andrus...@yahoo.com> wrote:
> Thanks Don!
>
> One follow up question - is there a way to NOT allow the user to enter
> the words "request" or "issue" in the string, displaying an error if
> they do?
>
> On Jan 27, 1:21*pm, Don Guillett <dguille...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You don't need a named range for this

>
> > Sub msgboxvaluetonextrowSAS()
> > Dim ans As String
> > ans = InputBox("Enter Value", vbOKCancel)
> > Cells(2, "a").End(xlDown).Offset(1) = ans
> > End Sub

>
> > On Jan 27, 1:49*pm, Steve <steve_andrus...@yahoo.com> wrote:

>
> > > Hi all. *I have a dynamic named range in Sheet1 A2:A100. *I wouldlike
> > > to call a macro to pop an input box asking for a new value, and then
> > > write that value in the next available cell in my named range. *Any
> > > idea how I can accomplish this?

>
> > > Thanks!- Hide quoted text -

>
> > - Show quoted text -

Sub msgboxvaluetonextrowSAS()
Dim ans As String
ans = InputBox("Enter Value", vbOKCancel)
If UCase(ans) = "REQUEST" Or UCase(ans) = "ISSUE" Then
MsgBox "Not allowed"
Else
Cells(1, "a").End(xlDown).Offset(1) = ans
End If
End Sub
 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      27th Jan 2012
Thanks Don! Is there a way to use a "contains" function as opposed to
an equal to? For example, I also need to prevent the user from
entering "Compliance Request".

Thanks!

On Jan 27, 2:17*pm, Don Guillett <dguille...@gmail.com> wrote:
> On Jan 27, 3:08*pm, Steve <steve_andrus...@yahoo.com> wrote:
>
>
>
> > Thanks Don!

>
> > One follow up question - is there a way to NOT allow the user to enter
> > the words "request" or "issue" in the string, displaying an error if
> > they do?

>
> > On Jan 27, 1:21*pm, Don Guillett <dguille...@gmail.com> wrote:

>
> > > You don't need a named range for this

>
> > > Sub msgboxvaluetonextrowSAS()
> > > Dim ans As String
> > > ans = InputBox("Enter Value", vbOKCancel)
> > > Cells(2, "a").End(xlDown).Offset(1) = ans
> > > End Sub

>
> > > On Jan 27, 1:49*pm, Steve <steve_andrus...@yahoo.com> wrote:

>
> > > > Hi all. *I have a dynamic named range in Sheet1 A2:A100. *I would like
> > > > to call a macro to pop an input box asking for a new value, and then
> > > > write that value in the next available cell in my named range. *Any
> > > > idea how I can accomplish this?

>
> > > > Thanks!- Hide quoted text -

>
> > > - Show quoted text -

>
> Sub msgboxvaluetonextrowSAS()
> Dim ans As String
> ans = InputBox("Enter Value", vbOKCancel)
> If UCase(ans) = "REQUEST" Or UCase(ans) = "ISSUE" Then
> MsgBox "Not allowed"
> Else
> Cells(1, "a").End(xlDown).Offset(1) = ans
> End If
> End Sub- Hide quoted text -
>
> - Show quoted text -


 
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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:38 PM.