PC Review


Reply
Thread Tools Rate Thread

Dialog box for Inserting Rows

 
 
Scott
Guest
Posts: n/a
 
      25th Sep 2008
Hi, I have a sheet which I want the user to be able to specify the number or
rows to insert.
 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      25th Sep 2008
I'll try that again... I have a sheet(s) which I want the user to be able to
specify the number or rows to insert. I already have the code to get the
cursor to the right place in the sheet to insert the rows. What I would like
is to have button which brings up a dialog box asking "how many rows?" the
user types in "n" and clicks OK, then excel inserts "n" rows above the cursor.

Any thoughts?

cheers

Scott

"Scott" wrote:

> Hi, I have a sheet which I want the user to be able to specify the number or
> rows to insert.

 
Reply With Quote
 
Bob Bridges
Guest
Posts: n/a
 
      25th Sep 2008
Cool, Scott! I've always wanted to have such a sheet. Congratulations.

How's it working for you?

Seriously, you gotta ask a question, man. As it is, you don't need to post
this on the Excel Programming forum; the solution is just to have your user
place the selection where he wants the new rows to go, then highlight as many
cells (in the downward direction) as he wants to insert - if he wants to
insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
right, though I'm doing it by memory) and voila! three new rows inserted,
without your even having to write a program for it.

But you wouldn't have posted here if you were satisfied with that solution,
so obviously you have some constraints. What are they? What DON'T you want
your user to have to do, and what are you willing to do yourself, and what do
you want the solution to look like to the user, and what have you tried
already, and what happens when you try that? Give us something to go on.

--- "Scott" wrote:
> Hi, I have a sheet which I want the user to be able to specify the number or
> rows to insert.

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      25th Sep 2008
When you say you have code to bring your cursor to the right place on the
sheet I am assuming you are selecting a cell. If that is the case insert
this portion of code after you have selected the cell:

Dim x As Integer

On Error Resume Next
x = InputBox("How many rows do you want to insert?")
On Error GoTo 0

If x <> 0 Then
Rows(ActiveCell.Row).Resize(x).EntireRow.Insert
End If

Hope this helps! If so, please click "YES" below.
--
Cheers,
Ryan


"Scott" wrote:

> I'll try that again... I have a sheet(s) which I want the user to be able to
> specify the number or rows to insert. I already have the code to get the
> cursor to the right place in the sheet to insert the rows. What I would like
> is to have button which brings up a dialog box asking "how many rows?" the
> user types in "n" and clicks OK, then excel inserts "n" rows above the cursor.
>
> Any thoughts?
>
> cheers
>
> Scott
>
> "Scott" wrote:
>
> > Hi, I have a sheet which I want the user to be able to specify the number or
> > rows to insert.

 
Reply With Quote
 
Scott
Guest
Posts: n/a
 
      25th Sep 2008
G'Day 'Bob'

You do a good job with sarcasm, makes an Australian blush. However you will
notice I immediately posted a reply to my question after a fat finger fault
cut the original post short.

Thank you for your concern and I agree to all your points.

Scott

"Bob Bridges" wrote:

> Cool, Scott! I've always wanted to have such a sheet. Congratulations.
>
> How's it working for you?
>
> Seriously, you gotta ask a question, man. As it is, you don't need to post
> this on the Excel Programming forum; the solution is just to have your user
> place the selection where he wants the new rows to go, then highlight as many
> cells (in the downward direction) as he wants to insert - if he wants to
> insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
> highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
> right, though I'm doing it by memory) and voila! three new rows inserted,
> without your even having to write a program for it.
>
> But you wouldn't have posted here if you were satisfied with that solution,
> so obviously you have some constraints. What are they? What DON'T you want
> your user to have to do, and what are you willing to do yourself, and what do
> you want the solution to look like to the user, and what have you tried
> already, and what happens when you try that? Give us something to go on.
>
> --- "Scott" wrote:
> > Hi, I have a sheet which I want the user to be able to specify the number or
> > rows to insert.

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      25th Sep 2008
Did my post help you? Or is there something else?
--
Cheers,
Ryan


"Scott" wrote:

> G'Day 'Bob'
>
> You do a good job with sarcasm, makes an Australian blush. However you will
> notice I immediately posted a reply to my question after a fat finger fault
> cut the original post short.
>
> Thank you for your concern and I agree to all your points.
>
> Scott
>
> "Bob Bridges" wrote:
>
> > Cool, Scott! I've always wanted to have such a sheet. Congratulations.
> >
> > How's it working for you?
> >
> > Seriously, you gotta ask a question, man. As it is, you don't need to post
> > this on the Excel Programming forum; the solution is just to have your user
> > place the selection where he wants the new rows to go, then highlight as many
> > cells (in the downward direction) as he wants to insert - if he wants to
> > insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
> > highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
> > right, though I'm doing it by memory) and voila! three new rows inserted,
> > without your even having to write a program for it.
> >
> > But you wouldn't have posted here if you were satisfied with that solution,
> > so obviously you have some constraints. What are they? What DON'T you want
> > your user to have to do, and what are you willing to do yourself, and what do
> > you want the solution to look like to the user, and what have you tried
> > already, and what happens when you try that? Give us something to go on.
> >
> > --- "Scott" wrote:
> > > Hi, I have a sheet which I want the user to be able to specify the number or
> > > rows to insert.

 
Reply With Quote
 
Scott
Guest
Posts: n/a
 
      25th Sep 2008
G'Day Ryan,

Yep, it works a treat. I just have to figure out the easist way to apply the
formats and formulas from the row above the cursor start position. But thats
another problem, your code worked great, thanks.

Scott

"RyanH" wrote:

> Did my post help you? Or is there something else?
> --
> Cheers,
> Ryan
>
>
> "Scott" wrote:
>
> > G'Day 'Bob'
> >
> > You do a good job with sarcasm, makes an Australian blush. However you will
> > notice I immediately posted a reply to my question after a fat finger fault
> > cut the original post short.
> >
> > Thank you for your concern and I agree to all your points.
> >
> > Scott
> >
> > "Bob Bridges" wrote:
> >
> > > Cool, Scott! I've always wanted to have such a sheet. Congratulations.
> > >
> > > How's it working for you?
> > >
> > > Seriously, you gotta ask a question, man. As it is, you don't need to post
> > > this on the Excel Programming forum; the solution is just to have your user
> > > place the selection where he wants the new rows to go, then highlight as many
> > > cells (in the downward direction) as he wants to insert - if he wants to
> > > insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
> > > highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
> > > right, though I'm doing it by memory) and voila! three new rows inserted,
> > > without your even having to write a program for it.
> > >
> > > But you wouldn't have posted here if you were satisfied with that solution,
> > > so obviously you have some constraints. What are they? What DON'T you want
> > > your user to have to do, and what are you willing to do yourself, and what do
> > > you want the solution to look like to the user, and what have you tried
> > > already, and what happens when you try that? Give us something to go on.
> > >
> > > --- "Scott" wrote:
> > > > Hi, I have a sheet which I want the user to be able to specify the number or
> > > > rows to insert.

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      25th Sep 2008
If you add 1 to the ActiveCell.Row it will insert the formats also. The
formulas you will have to do yourself.

Rows(ActiveCell.Row+1).Resize(x).EntireRow.Insert

Hope this helps! If so, please click "YES" below
--
Cheers,
Ryan


"Scott" wrote:

> G'Day Ryan,
>
> Yep, it works a treat. I just have to figure out the easist way to apply the
> formats and formulas from the row above the cursor start position. But thats
> another problem, your code worked great, thanks.
>
> Scott
>
> "RyanH" wrote:
>
> > Did my post help you? Or is there something else?
> > --
> > Cheers,
> > Ryan
> >
> >
> > "Scott" wrote:
> >
> > > G'Day 'Bob'
> > >
> > > You do a good job with sarcasm, makes an Australian blush. However you will
> > > notice I immediately posted a reply to my question after a fat finger fault
> > > cut the original post short.
> > >
> > > Thank you for your concern and I agree to all your points.
> > >
> > > Scott
> > >
> > > "Bob Bridges" wrote:
> > >
> > > > Cool, Scott! I've always wanted to have such a sheet. Congratulations.
> > > >
> > > > How's it working for you?
> > > >
> > > > Seriously, you gotta ask a question, man. As it is, you don't need to post
> > > > this on the Excel Programming forum; the solution is just to have your user
> > > > place the selection where he wants the new rows to go, then highlight as many
> > > > cells (in the downward direction) as he wants to insert - if he wants to
> > > > insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
> > > > highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
> > > > right, though I'm doing it by memory) and voila! three new rows inserted,
> > > > without your even having to write a program for it.
> > > >
> > > > But you wouldn't have posted here if you were satisfied with that solution,
> > > > so obviously you have some constraints. What are they? What DON'T you want
> > > > your user to have to do, and what are you willing to do yourself, and what do
> > > > you want the solution to look like to the user, and what have you tried
> > > > already, and what happens when you try that? Give us something to go on.
> > > >
> > > > --- "Scott" wrote:
> > > > > Hi, I have a sheet which I want the user to be able to specify the number or
> > > > > rows to insert.

 
Reply With Quote
 
Bob Bridges
Guest
Posts: n/a
 
      26th Sep 2008
Aww, you spoil my enjoyment, Scott. If you just hit a button too soon,
that's nothing I may reasonably wax sarcastic about.

Oh, well, I can always hope for next time. :-)

--- "Scott" wrote:
> G'Day 'Bob'
>
> You do a good job with sarcasm, makes an Australian blush. However you will
> notice I immediately posted a reply to my question after a fat finger fault
> cut the original post short.
>
> --- "Bob Bridges" wrote:
> > Cool, Scott! I've always wanted to have such a sheet. Congratulations.
> >
> > How's it working for you?
> >
> > Seriously, you gotta ask a question, man. As it is, you don't need to post
> > this on the Excel Programming forum; the solution is just to have your user
> > place the selection where he wants the new rows to go, then highlight as many
> > cells (in the downward direction) as he wants to insert - if he wants to
> > insert three rows, he specifies that by hitting <Shift-Down-Down>, thus
> > highlighting three cells. Then he can hit <Alt-I>nsert, Rows (I think that's
> > right, though I'm doing it by memory) and voila! three new rows inserted,
> > without your even having to write a program for it.
> >
> > But you wouldn't have posted here if you were satisfied with that solution,
> > so obviously you have some constraints. What are they? What DON'T
> > you want your user to have to do, and what are you willing to do yourself,
> > and what do you want the solution to look like to the user, and what have
> > you tried already, and what happens when you try that? Give us
> > something to go on.
> >
> > --- "Scott" wrote:
> > > Hi, I have a sheet which I want the user to be able to specify the number or
> > > rows to insert.

 
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
Inserting Blank rows after every row upto 2500 rows Manju Microsoft Excel Worksheet Functions 16 22nd Aug 2006 12:54 PM
Inserting multiple rows in excel with data in consecutive rows =?Utf-8?B?dGVjaG5vdHJvbmlj?= Microsoft Excel Programming 2 20th Oct 2005 03:12 PM
inserting rows and open file dialog dannia@jamesons.com.au Microsoft Excel Programming 1 6th Apr 2005 03:35 AM
Inserting Multiple Blank Rows On Alternate Rows GARY Microsoft Excel Worksheet Functions 1 13th Apr 2004 05:29 PM
Inserting blank rows between data rows (mutliple at one time) DP Microsoft Excel Misc 2 21st Oct 2003 06:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 AM.