Select a specifik cell in a row to count from

Perbjo

New Member
Joined
May 5, 2022
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi

I have this bit of code for an userform, where I add name of a car and its pricetag. And it works fine if it's just starting from A1.
I want it to start counting from A15 where I have my titleObjects, but I cant make it work almost no matter how I try.
My goal is that First car and price should go into A16:B16, second car and price A17:B17 and so on.

My second goal is to have another range starting at A1 to have Motorcycle name and price tag.
I havn't created an userform for this one, but it will be similar to the other.

Somehow I think it's simple, but I cant figure out how to make it happen.
Hopefully some of you experts can help :)
1662402893748.png
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
After the line r = Range(etc etc add:
VBA Code:
If r<15 then r=15

Suggest that r be dimmed "as Long", rather then "as Single"
 
Upvote 0
Solution
After the line r = Range(etc etc add:
VBA Code:
If r<15 then r=15

Suggest that r be dimmed "as Long", rather then "as Single"
YES - This is exactly what I was looking for - thanks a lot Anthony.
 
Upvote 0
Thank you for the feedback
You're welcome :)
Unfortunately I'll have to disturb you once more. Your suggestion is perfect for beginning in A15.
I'm trying to make another starting i A2 on the same sheet with your suggestion added (If r<2 then r=2).
The problem here is, if I already run the userform starting at A15, then the other userform will add value to A16 instead of A2.
Is there a solution to this?
 
Upvote 0
You mean that on the same worksheet you have two groups of information: the first starting from A15 going down and the second starting from A2 up to A14?
 
Upvote 0
In the second group of code you need to calculate R from row 15 up:
VBA Code:
r = range("A15").end(xlup).row + 1
No need to test if <2

But are you sure that this upper group will never fill up to row 14? do we need to test for this possible situation?
 
Upvote 0
In the second group of code you need to calculate R from row 15 up:
VBA Code:
r = range("A15").end(xlup).row + 1
No need to test if <2

But are you sure that this upper group will never fill up to row 14? do we need to test for this possible situation?
Thank you for your effort, that really helped me out of frustration:)
No, I can't be sure for certain - but right now I'm trying to help a small company and unless it expands enormous,
there will never be use of more rows.
But if it should happen, I suppose I will put these two beside one another for userbility and for the look of it.
 
Upvote 0
If the first goup fill up to row 14 that will be a mess
We could insert a test for row 14 beeing empty, but then what the user have to do if there is no space?
I would suggest that the two groups be separated; for example group1 in columns (say) A:H and group2 in columns J:Z; or group1 in sheet1 and group2 in sheet2
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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