PC Review


Reply
Thread Tools Rate Thread

adding conditional rows

 
 
=?Utf-8?B?RGVlcGFrIFZhcmRl?=
Guest
Posts: n/a
 
      10th Jul 2006
Hello, I want to be able to have rows/cells generated with a certain text
based on the answer given by a user.
For example, My question in a cell could be "how many groups have you made?".
Now to this if the user answers "3" then I would want three cells below to
ask "what is the name of your first group", "what is the name of your second
group" and so on. Based on this further questions could be asked.
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      10th Jul 2006
Have a look in vba help index for INPUTBOX

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Deepak Varde" <Deepak (E-Mail Removed)> wrote in message
news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> Hello, I want to be able to have rows/cells generated with a certain text
> based on the answer given by a user.
> For example, My question in a cell could be "how many groups have you
> made?".
> Now to this if the user answers "3" then I would want three cells below to
> ask "what is the name of your first group", "what is the name of your
> second
> group" and so on. Based on this further questions could be asked.



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jul 2006
As a astarter

Sub Macro1()
Dim ans
Dim i As Long
Dim sName As String

ans = InputBox("How many groups have you made")
If ans <> "" Then
ActiveCell.Offset(1, 0).Resize(3).Insert
For i = 1 To ans
sName = InputBox("What is the name of group #" & i)
ActiveCell.Offset(i, 0).Value = sName
Next i
End If

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Deepak Varde" <Deepak (E-Mail Removed)> wrote in message
news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> Hello, I want to be able to have rows/cells generated with a certain text
> based on the answer given by a user.
> For example, My question in a cell could be "how many groups have you

made?".
> Now to this if the user answers "3" then I would want three cells below to
> ask "what is the name of your first group", "what is the name of your

second
> group" and so on. Based on this further questions could be asked.



 
Reply With Quote
 
=?Utf-8?B?RGVlcGFrIFZhcmRl?=
Guest
Posts: n/a
 
      10th Jul 2006
Hello Bob,
Can I do this without the VB? I dont know how to program macros or any form
of VB. I was looking more towards understanding the concept and then
applying. If there is no way then I would try and understand the solution
that you've provided.


"Bob Phillips" wrote:

> As a astarter
>
> Sub Macro1()
> Dim ans
> Dim i As Long
> Dim sName As String
>
> ans = InputBox("How many groups have you made")
> If ans <> "" Then
> ActiveCell.Offset(1, 0).Resize(3).Insert
> For i = 1 To ans
> sName = InputBox("What is the name of group #" & i)
> ActiveCell.Offset(i, 0).Value = sName
> Next i
> End If
>
> End Sub
>
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Deepak Varde" <Deepak (E-Mail Removed)> wrote in message
> news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > Hello, I want to be able to have rows/cells generated with a certain text
> > based on the answer given by a user.
> > For example, My question in a cell could be "how many groups have you

> made?".
> > Now to this if the user answers "3" then I would want three cells below to
> > ask "what is the name of your first group", "what is the name of your

> second
> > group" and so on. Based on this further questions could be asked.

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jul 2006
Not really. You might be able to get some way with conditional
formulae/formatting, but not for the sort of flexibility that you seek.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Deepak Varde" <(E-Mail Removed)> wrote in message
news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
> Hello Bob,
> Can I do this without the VB? I dont know how to program macros or any

form
> of VB. I was looking more towards understanding the concept and then
> applying. If there is no way then I would try and understand the solution
> that you've provided.
>
>
> "Bob Phillips" wrote:
>
> > As a astarter
> >
> > Sub Macro1()
> > Dim ans
> > Dim i As Long
> > Dim sName As String
> >
> > ans = InputBox("How many groups have you made")
> > If ans <> "" Then
> > ActiveCell.Offset(1, 0).Resize(3).Insert
> > For i = 1 To ans
> > sName = InputBox("What is the name of group #" & i)
> > ActiveCell.Offset(i, 0).Value = sName
> > Next i
> > End If
> >
> > End Sub
> >
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Deepak Varde" <Deepak (E-Mail Removed)> wrote in message
> > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > > Hello, I want to be able to have rows/cells generated with a certain

text
> > > based on the answer given by a user.
> > > For example, My question in a cell could be "how many groups have you

> > made?".
> > > Now to this if the user answers "3" then I would want three cells

below to
> > > ask "what is the name of your first group", "what is the name of your

> > second
> > > group" and so on. Based on this further questions could be asked.

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?RGVlcGFrIFZhcmRl?=
Guest
Posts: n/a
 
      10th Jul 2006
thank you bob, your help was indeed very useful. Now could you pls tell me,
what reading material should I refer to, to understand programming macros?


"Bob Phillips" wrote:

> Not really. You might be able to get some way with conditional
> formulae/formatting, but not for the sort of flexibility that you seek.
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Deepak Varde" <(E-Mail Removed)> wrote in message
> news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
> > Hello Bob,
> > Can I do this without the VB? I dont know how to program macros or any

> form
> > of VB. I was looking more towards understanding the concept and then
> > applying. If there is no way then I would try and understand the solution
> > that you've provided.
> >
> >
> > "Bob Phillips" wrote:
> >
> > > As a astarter
> > >
> > > Sub Macro1()
> > > Dim ans
> > > Dim i As Long
> > > Dim sName As String
> > >
> > > ans = InputBox("How many groups have you made")
> > > If ans <> "" Then
> > > ActiveCell.Offset(1, 0).Resize(3).Insert
> > > For i = 1 To ans
> > > sName = InputBox("What is the name of group #" & i)
> > > ActiveCell.Offset(i, 0).Value = sName
> > > Next i
> > > End If
> > >
> > > End Sub
> > >
> > >
> > > --
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace somewhere in email address with gmail if mailing direct)
> > >
> > > "Deepak Varde" <Deepak (E-Mail Removed)> wrote in message
> > > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > > > Hello, I want to be able to have rows/cells generated with a certain

> text
> > > > based on the answer given by a user.
> > > > For example, My question in a cell could be "how many groups have you
> > > made?".
> > > > Now to this if the user answers "3" then I would want three cells

> below to
> > > > ask "what is the name of your first group", "what is the name of your
> > > second
> > > > group" and so on. Based on this further questions could be asked.
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jul 2006
Deepak,

Try starting here


'Getting Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


You might also look at David's tutorials page at:

http://www.mvps.org/dmcritchie/excel....htm#tutorials


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Deepak Varde" <(E-Mail Removed)> wrote in message
news:AE2B7597-1624-4850-A568-(E-Mail Removed)...
> thank you bob, your help was indeed very useful. Now could you pls tell

me,
> what reading material should I refer to, to understand programming macros?
>
>
> "Bob Phillips" wrote:
>
> > Not really. You might be able to get some way with conditional
> > formulae/formatting, but not for the sort of flexibility that you seek.
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Deepak Varde" <(E-Mail Removed)> wrote in message
> > news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
> > > Hello Bob,
> > > Can I do this without the VB? I dont know how to program macros or any

> > form
> > > of VB. I was looking more towards understanding the concept and then
> > > applying. If there is no way then I would try and understand the

solution
> > > that you've provided.
> > >
> > >
> > > "Bob Phillips" wrote:
> > >
> > > > As a astarter
> > > >
> > > > Sub Macro1()
> > > > Dim ans
> > > > Dim i As Long
> > > > Dim sName As String
> > > >
> > > > ans = InputBox("How many groups have you made")
> > > > If ans <> "" Then
> > > > ActiveCell.Offset(1, 0).Resize(3).Insert
> > > > For i = 1 To ans
> > > > sName = InputBox("What is the name of group #" & i)
> > > > ActiveCell.Offset(i, 0).Value = sName
> > > > Next i
> > > > End If
> > > >
> > > > End Sub
> > > >
> > > >
> > > > --
> > > > HTH
> > > >
> > > > Bob Phillips
> > > >
> > > > (replace somewhere in email address with gmail if mailing direct)
> > > >
> > > > "Deepak Varde" <Deepak (E-Mail Removed)> wrote in

message
> > > > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > > > > Hello, I want to be able to have rows/cells generated with a

certain
> > text
> > > > > based on the answer given by a user.
> > > > > For example, My question in a cell could be "how many groups have

you
> > > > made?".
> > > > > Now to this if the user answers "3" then I would want three cells

> > below to
> > > > > ask "what is the name of your first group", "what is the name of

your
> > > > second
> > > > > group" and so on. Based on this further questions could be asked.
> > > >
> > > >
> > > >

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?RGVlcGFrIFZhcmRl?=
Guest
Posts: n/a
 
      10th Jul 2006
Thank you Bob. Thanks a million.


"Bob Phillips" wrote:

> Deepak,
>
> Try starting here
>
>
> 'Getting Started With Macros And User Defined Functions' at:
>
> http://www.mvps.org/dmcritchie/excel/getstarted.htm
>
>
> You might also look at David's tutorials page at:
>
> http://www.mvps.org/dmcritchie/excel....htm#tutorials
>
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Deepak Varde" <(E-Mail Removed)> wrote in message
> news:AE2B7597-1624-4850-A568-(E-Mail Removed)...
> > thank you bob, your help was indeed very useful. Now could you pls tell

> me,
> > what reading material should I refer to, to understand programming macros?
> >
> >
> > "Bob Phillips" wrote:
> >
> > > Not really. You might be able to get some way with conditional
> > > formulae/formatting, but not for the sort of flexibility that you seek.
> > >
> > > --
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace somewhere in email address with gmail if mailing direct)
> > >
> > > "Deepak Varde" <(E-Mail Removed)> wrote in message
> > > news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
> > > > Hello Bob,
> > > > Can I do this without the VB? I dont know how to program macros or any
> > > form
> > > > of VB. I was looking more towards understanding the concept and then
> > > > applying. If there is no way then I would try and understand the

> solution
> > > > that you've provided.
> > > >
> > > >
> > > > "Bob Phillips" wrote:
> > > >
> > > > > As a astarter
> > > > >
> > > > > Sub Macro1()
> > > > > Dim ans
> > > > > Dim i As Long
> > > > > Dim sName As String
> > > > >
> > > > > ans = InputBox("How many groups have you made")
> > > > > If ans <> "" Then
> > > > > ActiveCell.Offset(1, 0).Resize(3).Insert
> > > > > For i = 1 To ans
> > > > > sName = InputBox("What is the name of group #" & i)
> > > > > ActiveCell.Offset(i, 0).Value = sName
> > > > > Next i
> > > > > End If
> > > > >
> > > > > End Sub
> > > > >
> > > > >
> > > > > --
> > > > > HTH
> > > > >
> > > > > Bob Phillips
> > > > >
> > > > > (replace somewhere in email address with gmail if mailing direct)
> > > > >
> > > > > "Deepak Varde" <Deepak (E-Mail Removed)> wrote in

> message
> > > > > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > > > > > Hello, I want to be able to have rows/cells generated with a

> certain
> > > text
> > > > > > based on the answer given by a user.
> > > > > > For example, My question in a cell could be "how many groups have

> you
> > > > > made?".
> > > > > > Now to this if the user answers "3" then I would want three cells
> > > below to
> > > > > > ask "what is the name of your first group", "what is the name of

> your
> > > > > second
> > > > > > group" and so on. Based on this further questions could be asked.
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?RGVlcGFrIFZhcmRl?=
Guest
Posts: n/a
 
      11th Jul 2006
Dear Bob,

In the solution provided by you, how do I assign a perticular cell to
capture/store the user inputs from the questions answered in the inputbox

Regards,
Deepak

"Deepak Varde" wrote:

> Thank you Bob. Thanks a million.
>
>
> "Bob Phillips" wrote:
>
> > Deepak,
> >
> > Try starting here
> >
> >
> > 'Getting Started With Macros And User Defined Functions' at:
> >
> > http://www.mvps.org/dmcritchie/excel/getstarted.htm
> >
> >
> > You might also look at David's tutorials page at:
> >
> > http://www.mvps.org/dmcritchie/excel....htm#tutorials
> >
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Deepak Varde" <(E-Mail Removed)> wrote in message
> > news:AE2B7597-1624-4850-A568-(E-Mail Removed)...
> > > thank you bob, your help was indeed very useful. Now could you pls tell

> > me,
> > > what reading material should I refer to, to understand programming macros?
> > >
> > >
> > > "Bob Phillips" wrote:
> > >
> > > > Not really. You might be able to get some way with conditional
> > > > formulae/formatting, but not for the sort of flexibility that you seek.
> > > >
> > > > --
> > > > HTH
> > > >
> > > > Bob Phillips
> > > >
> > > > (replace somewhere in email address with gmail if mailing direct)
> > > >
> > > > "Deepak Varde" <(E-Mail Removed)> wrote in message
> > > > news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
> > > > > Hello Bob,
> > > > > Can I do this without the VB? I dont know how to program macros or any
> > > > form
> > > > > of VB. I was looking more towards understanding the concept and then
> > > > > applying. If there is no way then I would try and understand the

> > solution
> > > > > that you've provided.
> > > > >
> > > > >
> > > > > "Bob Phillips" wrote:
> > > > >
> > > > > > As a astarter
> > > > > >
> > > > > > Sub Macro1()
> > > > > > Dim ans
> > > > > > Dim i As Long
> > > > > > Dim sName As String
> > > > > >
> > > > > > ans = InputBox("How many groups have you made")
> > > > > > If ans <> "" Then
> > > > > > ActiveCell.Offset(1, 0).Resize(3).Insert
> > > > > > For i = 1 To ans
> > > > > > sName = InputBox("What is the name of group #" & i)
> > > > > > ActiveCell.Offset(i, 0).Value = sName
> > > > > > Next i
> > > > > > End If
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > >
> > > > > > --
> > > > > > HTH
> > > > > >
> > > > > > Bob Phillips
> > > > > >
> > > > > > (replace somewhere in email address with gmail if mailing direct)
> > > > > >
> > > > > > "Deepak Varde" <Deepak (E-Mail Removed)> wrote in

> > message
> > > > > > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
> > > > > > > Hello, I want to be able to have rows/cells generated with a

> > certain
> > > > text
> > > > > > > based on the answer given by a user.
> > > > > > > For example, My question in a cell could be "how many groups have

> > you
> > > > > > made?".
> > > > > > > Now to this if the user answers "3" then I would want three cells
> > > > below to
> > > > > > > ask "what is the name of your first group", "what is the name of

> > your
> > > > > > second
> > > > > > > group" and so on. Based on this further questions could be asked.
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >

> >
> >
> >

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      11th Jul 2006
If I properly understand you, Bob provided that in his first post
another idea

range("a1").value=inputbox("your question")

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Deepak Varde" <(E-Mail Removed)> wrote in message
news:ED7F28B4-9FFC-435D-B18E-(E-Mail Removed)...
> Dear Bob,
>
> In the solution provided by you, how do I assign a perticular cell to
> capture/store the user inputs from the questions answered in the inputbox
>
> Regards,
> Deepak
>
> "Deepak Varde" wrote:
>
>> Thank you Bob. Thanks a million.
>>
>>
>> "Bob Phillips" wrote:
>>
>> > Deepak,
>> >
>> > Try starting here
>> >
>> >
>> > 'Getting Started With Macros And User Defined Functions' at:
>> >
>> > http://www.mvps.org/dmcritchie/excel/getstarted.htm
>> >
>> >
>> > You might also look at David's tutorials page at:
>> >
>> > http://www.mvps.org/dmcritchie/excel....htm#tutorials
>> >
>> >
>> > --
>> > HTH
>> >
>> > Bob Phillips
>> >
>> > (replace somewhere in email address with gmail if mailing direct)
>> >
>> > "Deepak Varde" <(E-Mail Removed)> wrote in message
>> > news:AE2B7597-1624-4850-A568-(E-Mail Removed)...
>> > > thank you bob, your help was indeed very useful. Now could you pls
>> > > tell
>> > me,
>> > > what reading material should I refer to, to understand programming
>> > > macros?
>> > >
>> > >
>> > > "Bob Phillips" wrote:
>> > >
>> > > > Not really. You might be able to get some way with conditional
>> > > > formulae/formatting, but not for the sort of flexibility that you
>> > > > seek.
>> > > >
>> > > > --
>> > > > HTH
>> > > >
>> > > > Bob Phillips
>> > > >
>> > > > (replace somewhere in email address with gmail if mailing direct)
>> > > >
>> > > > "Deepak Varde" <(E-Mail Removed)> wrote in
>> > > > message
>> > > > news:F9A968E2-A3D3-4A5A-A6F2-(E-Mail Removed)...
>> > > > > Hello Bob,
>> > > > > Can I do this without the VB? I dont know how to program macros
>> > > > > or any
>> > > > form
>> > > > > of VB. I was looking more towards understanding the concept and
>> > > > > then
>> > > > > applying. If there is no way then I would try and understand the
>> > solution
>> > > > > that you've provided.
>> > > > >
>> > > > >
>> > > > > "Bob Phillips" wrote:
>> > > > >
>> > > > > > As a astarter
>> > > > > >
>> > > > > > Sub Macro1()
>> > > > > > Dim ans
>> > > > > > Dim i As Long
>> > > > > > Dim sName As String
>> > > > > >
>> > > > > > ans = InputBox("How many groups have you made")
>> > > > > > If ans <> "" Then
>> > > > > > ActiveCell.Offset(1, 0).Resize(3).Insert
>> > > > > > For i = 1 To ans
>> > > > > > sName = InputBox("What is the name of group #" & i)
>> > > > > > ActiveCell.Offset(i, 0).Value = sName
>> > > > > > Next i
>> > > > > > End If
>> > > > > >
>> > > > > > End Sub
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > > HTH
>> > > > > >
>> > > > > > Bob Phillips
>> > > > > >
>> > > > > > (replace somewhere in email address with gmail if mailing
>> > > > > > direct)
>> > > > > >
>> > > > > > "Deepak Varde" <Deepak (E-Mail Removed)> wrote
>> > > > > > in
>> > message
>> > > > > > news:32E01D6E-DD9A-4662-9982-(E-Mail Removed)...
>> > > > > > > Hello, I want to be able to have rows/cells generated with a
>> > certain
>> > > > text
>> > > > > > > based on the answer given by a user.
>> > > > > > > For example, My question in a cell could be "how many groups
>> > > > > > > have
>> > you
>> > > > > > made?".
>> > > > > > > Now to this if the user answers "3" then I would want three
>> > > > > > > cells
>> > > > below to
>> > > > > > > ask "what is the name of your first group", "what is the name
>> > > > > > > of
>> > your
>> > > > > > second
>> > > > > > > group" and so on. Based on this further questions could be
>> > > > > > > asked.
>> > > > > >
>> > > > > >
>> > > > > >
>> > > >
>> > > >
>> > > >
>> >
>> >
>> >



 
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
Adding my own rows to a Union Query without adding another table? PaulSchrum Microsoft Access Queries 3 15th Feb 2011 08:28 PM
adding some rows in the middle of adding some other rows =?Utf-8?B?SmFuaXM=?= Microsoft Excel Programming 3 4th Oct 2007 03:20 AM
Adding rows to a data table: Rows do not show up =?Utf-8?B?dnZlbms=?= Microsoft VB .NET 2 10th Oct 2006 12:07 AM
Adding Rows offsets to working rows across two worksheets =?Utf-8?B?VG9t?= Microsoft Excel Setup 3 30th Jul 2006 07:54 PM
How to prevent drawing DataGrid rows while adding rows? =?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?= Microsoft C# .NET 2 6th Apr 2005 04:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:34 AM.