If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Find next blank row after criteria
I'm really struggling here. I've inherited a very complicated data sheet
that can not be split up in to different worksheets. I have lots of supplier spend data listed and i've got it sorted in by supplier. Ok, so each supplier has different formulars to be applied to the data that is to be input. So i've inserted x number of blank rows with the correct formulars for that supplier, beneath each supplier in the list and now what i need to do, is when someone comes to add a new record for that supplier their data will go in to the data sheet in the next blank space under that supplier name. SOrry this is very long winded. Ok so simply i some code that will let me insert data by finding the next blank row after a specific point... i.e after a specified supplier which will be chosed in a combobox. 1. Does anyone have a clue what i'm going on about hehhee. 2. Can anyone help me? I'm not sure where to start. Thanks in advance, helen :0) --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Find next blank row after criteria
Hi, Helen,
paste this code as your macro. It assumes that in cell "B1" is the starting value of the row to search. So if B1 = 14, this will start searching for a blank in col A14 on down. You could add a combo box which puts the row num +1 of the supplier name row into B1. Hope this gets you started. jeff Sub cc() startrow = Range("B1") For Each c In Range(Cells(startrow, "a"), Cells (ActiveCell.End(xlDown).Row, "a")) c.Select If c = "" Then 'looks for blank ' If UCase(c) = "X" Then would look for an X MsgBox "ended at " & ActiveCell.Address ' insert data here Exit Sub End If If c.Row 500 Then Exit Sub 'escape Next End Sub -----Original Message----- I'm really struggling here. I've inherited a very complicated data sheet that can not be split up in to different worksheets. I have lots of supplier spend data listed and i've got it sorted in by supplier. Ok, so each supplier has different formulars to be applied to the data that is to be input. So i've inserted x number of blank rows with the correct formulars for that supplier, beneath each supplier in the list and now what i need to do, is when someone comes to add a new record for that supplier their data will go in to the data sheet in the next blank space under that supplier name. SOrry this is very long winded. Ok so simply i some code that will let me insert data by finding the next blank row after a specific point... i.e after a specified supplier which will be chosed in a combobox. 1. Does anyone have a clue what i'm going on about hehhee. 2. Can anyone help me? I'm not sure where to start. Thanks in advance, helen :0) --- Message posted from http://www.ExcelForum.com/ . |
#3
|
|||
|
|||
Find next blank row after criteria
I'm not sure i understand...
1. the range of my data starts at A8 and i'll be looking for the next blank in column (f) supplier column. 2. the code in red won't run... i presume because the variables aren't declared... ?? How would i do this 3. what data do i insert at the insert data here? is this where i tell it to unload the data from the form in to the table. ie in to the blank row? Sub cc() startrow = Range("B1") For Each c In Range(Cells(startrow, "a"), Cells (ActiveCell.End(xlDown).Row, "a")) c.Select If c = "" Then 'looks for blank ' If UCase(c) = "X" Then would look for an X MsgBox "ended at " & ActiveCell.Address ' insert data here Exit Sub End If If c.Row 500 Then Exit Sub 'escape Next End Sub --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|