PC Review


Reply
 
 
massi
Guest
Posts: n/a
 
      25th Mar 2009
hi. i have a spread sheet where i have to record some events.
the first row is already formatted and the first cell has a number 1.
i would like a macro to automatically create another line each time a press
a button and that would increase the number of the first cell from the
previous line.

a sheet like below:

number header2 header3
1 bla bla zzz zzzz
2 qwfjkd jjioeereorko
3 gdfgfgf frefsdfdf

i would like a macro that associated to a button automatically add a line
below the last one, keeping the same formatting of the cells and in the line
added increase the column "number" by 1

in order to have:

number header2 header3
1 bla bla zzz zzzz
2 qwfjkd jjioeereorko
3 gdfgfgf frefsdfdf
4



thanks
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      26th Mar 2009
To add a row you can use this code; but if you are looking at auto numbering
you can acheive this with a simple formula in column A =IF(B2<>"",A1+1,"")

lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Rows(lngRow + 1).Insert
Cells(lngRow + 1, 1) = Cells(lngRow, 1) + 1


If this post helps click Yes
---------------
Jacob Skaria


"massi" wrote:

> hi. i have a spread sheet where i have to record some events.
> the first row is already formatted and the first cell has a number 1.
> i would like a macro to automatically create another line each time a press
> a button and that would increase the number of the first cell from the
> previous line.
>
> a sheet like below:
>
> number header2 header3
> 1 bla bla zzz zzzz
> 2 qwfjkd jjioeereorko
> 3 gdfgfgf frefsdfdf
>
> i would like a macro that associated to a button automatically add a line
> below the last one, keeping the same formatting of the cells and in the line
> added increase the column "number" by 1
>
> in order to have:
>
> number header2 header3
> 1 bla bla zzz zzzz
> 2 qwfjkd jjioeereorko
> 3 gdfgfgf frefsdfdf
> 4
>
>
>
> thanks

 
Reply With Quote
 
massi
Guest
Posts: n/a
 
      26th Mar 2009
thanks!

"Jacob Skaria" wrote:

> To add a row you can use this code; but if you are looking at auto numbering
> you can acheive this with a simple formula in column A =IF(B2<>"",A1+1,"")
>
> lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
> Rows(lngRow + 1).Insert
> Cells(lngRow + 1, 1) = Cells(lngRow, 1) + 1
>
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "massi" wrote:
>
> > hi. i have a spread sheet where i have to record some events.
> > the first row is already formatted and the first cell has a number 1.
> > i would like a macro to automatically create another line each time a press
> > a button and that would increase the number of the first cell from the
> > previous line.
> >
> > a sheet like below:
> >
> > number header2 header3
> > 1 bla bla zzz zzzz
> > 2 qwfjkd jjioeereorko
> > 3 gdfgfgf frefsdfdf
> >
> > i would like a macro that associated to a button automatically add a line
> > below the last one, keeping the same formatting of the cells and in the line
> > added increase the column "number" by 1
> >
> > in order to have:
> >
> > number header2 header3
> > 1 bla bla zzz zzzz
> > 2 qwfjkd jjioeereorko
> > 3 gdfgfgf frefsdfdf
> > 4
> >
> >
> >
> > thanks

 
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
Need help please, Having trouble finding/adding users for purpose of granting permissions or adding them to groups in a win 2k domain on an XP workstation. rmalph@happy.days Microsoft Windows 2000 Security 4 16th Oct 2004 07:11 AM
Need help please, Having trouble finding/adding users for purpose of granting permissions or adding them to groups in a win 2k domain on an XP workstation. rmalph@happy.days Microsoft Windows 2000 New Users 1 12th Oct 2004 07:13 PM
Need help please, Having trouble finding/adding users for purpose of granting permissions or adding them to groups in a win 2k domain on an XP workstation. rmalph@happy.days Microsoft Windows 2000 Deployment 0 11th Oct 2004 11:39 PM
Need help please, Having trouble finding/adding users for purpose of granting permissions or adding them to groups in a win 2k domain on an XP workstation. rmalph@happy.days Microsoft Windows 2000 0 11th Oct 2004 11:37 PM
Need help please, Having trouble finding/adding users for purpose of granting permissions or adding them to groups in a win 2k domain on an XP workstation. rmalph@happy.days Microsoft Windows 2000 Deployment 0 11th Oct 2004 11:35 PM


Features
 

Advertising
 

Newsgroups
 


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