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!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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.
 
Upvote 0
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
 
Upvote 0
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!!!
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,428
Members
448,896
Latest member
MadMarty

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top