#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

Me again...

My small vba app adds a line to excel with information that is inpu
from date and time functions as well as user input. I want the firs
cell of the row to have an incrementing number. How would I have i
grab the number above it and then add 1 to it and input it into th
cell?

Thanks again for everyones help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

Should work with something like:

(Row X is inserted and colums Y has the increasing number. Increasemen
is Z)

Cells(X,Y).value = Cells(X-1,Y).value +

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

So would this be correct? The red line is where I want it to go.

Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Active Collection").Activate
Range("A1").Select

Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = Cells(0, 0).Value = Cells(0 - 1, 0).Value + 1
ActiveCell.Offset(0, 1) = Date
ActiveCell.Offset(0, 2) = Time
ActiveCell.Offset(0, 3) = txtCompany.Value
ActiveCell.Offset(0, 4) = txtName.Value
ActiveCell.Offset(0, 5) = txtPhone.Value
ActiveCell.Offset(0, 6) = txtInvoiceNo.Value
ActiveCell.Offset(0, 7) = cmbInvoiceType.Value
ActiveCell.Offset(0, 8) = txtInvoiceDate.Value
ActiveCell.Offset(0, 9) = txtAmount.Value
ActiveCell.Offset(0, 10) = txtSubStartDate.Value
ActiveCell.Offset(0, 11) = txtWhichInvoice.Value
ActiveCell.Offset(0, 12) = txtPaid.Value

Select Case True
Case opt30.Value
ActiveCell.Offset(0, 13) = txtPaid.Value
Case opt60.Value
ActiveCell.Offset(0, 14) = txtPaid.Value
Case opt90.Value
ActiveCell.Offset(0, 15) = txtPaid.Value
Case opt120.Value
ActiveCell.Offset(0, 16) = txtPaid.Value
Case opt121.Value
ActiveCell.Offset(0, 17) = txtPaid.Value
End Select

ActiveCell.Offset(0, 18) = "Invoice Amount"
ActiveCell.Offset(0, 19) = "Amount 1"
ActiveCell.Offset(0, 20) = "Amount 1"
ActiveCell.Offset(0, 21) = txtComments.Value

Range("A1").Select
Call frmNewCollect_Initialize
End Su

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

No... this way you are adressing row -1, which does not exist

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

So if I want it to pik up the first cell in row 13 and place it in 1
would it look like this.

ActiveCell.Value = Cells(0, 13).Value = Cells(0, 13).Value +

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enumeration

If activeCell.Row < 1 then _
ActiveCell.Value = ActiveCell.Offset(-1,0).Value + 1

--
Regards,
Tom Ogilvy

"stck2mlon " wrote in message
...
So if I want it to pik up the first cell in row 13 and place it in 14
would it look like this.

ActiveCell.Value = Cells(0, 13).Value = Cells(0, 13).Value + 1


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enumeration

That did it....thank you soooo much!!!

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
enumeration members adewole Excel Worksheet Functions 1 June 14th 07 06:38 PM
Using enumeration with controls UgetSpam Excel Programming 2 November 27th 03 06:57 PM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"