Code to populate next available range.

blacklab1059

New Member
Joined
Oct 10, 2006
Messages
8
I have created a form to enter test data. As an example, when I push a command button the first range populates with my form - range A9 to K12. How can I code the button or form to populate the next empty cells below this range with exactly the same form? This is my first post, I hope I have done this right. Any help would be greatly appreciated!
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Can you post the code that you have for populating A9:K12?
Then I or someone can help you with the next step and can post relevant replies rather than general suggestions.
 

Cbrine

Well-known Member
Joined
Dec 2, 2003
Messages
3,196
blacklab1059,
Welcome to the board. A little more information would be helpful, since I'm not entirely sure what you want to do. By the sounds of it, you are taking form data an storing it in ranges A9:K12??? From a database perspective this doesn't make sense, since you really only want to have a single record of data for each row?? I would first suggest you set your form to dump to a single row, unless there are constraints I'm not aware of. This will make the process of determining where to put the next set of values easier.

I would also suggest you post a sample of the code, so we can see what you are currently doing.

HTH
Cal
 

blacklab1059

New Member
Joined
Oct 10, 2006
Messages
8
I appreciate your help but I found a workable solution. I used the find last cell method and used an offset to get my range aligned. It is working flawlessly.

' Find the first empty cell in row A
Range("A65536").End(xlUp).Select

'Select the first row full row as top border and fill white
ActiveCell.Offset(1, 0).Range("A1:K1").Select

Every cell in the range is populated A:K so this works out well.

I have had programming classes at DeVry in C#, C++ and Java but this is the first I have done in Excell VBA.

I am now trying to find a solution to close a menu window when one of three commandbuttons is selected.

Option Explicit

Private Sub CommandButton1_Click()
Call NewTest
End Sub

Private Sub CommandButton2_Click()
Call MisEntry
End Sub

Private Sub CommandButton3_Click()
Call Complete
End Sub

Public Sub UserForm_Click()

End Sub

If you have any suggestions I would greatly appreciate them.
Thanks for your knowledge!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,113,955
Messages
5,545,162
Members
410,667
Latest member
Gaexel
Top