Getting .End(xlDown).Offset(1, 0).Select to work correctly

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
912
Office Version
  1. 365
Platform
  1. Windows
Row 100 contains the Text "Comments". With the cursor always on row 26 of the active column,
the following code is not working correctly
Code:
Cells(74, ActiveCell.Column).End(xlDown).Offset(1, 0).Select
 ActiveCell.Value = TextBox1.Value

It should put a new value from Textbox1 of Userform1 below any previously entered value
below row 100(Comments), and keep doing that. What it's doing
is erasing the value in row 101 each time and replacing it with the new value from Textbox1 instead
of putting it BELOW(i.e., the 1st blank cell) the previously entered value(s) below Comments(row 100)

I can't see anything wrong with this simple code operation. Csn anyone please show me what
is wrong wirh this code ?


Thanks for anyone's help

cr
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If your intent is to find the first blank cell then maybe
Rich (BB code):
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Offset(1, 0).Select


Test and see if your experience is any different
 
Upvote 0
Your code works for me , but try this instead

Do not need to select to put something in a cell
Start at 100 if it needs to be below 100

Code:
Cells(100, ActiveCell.Column).End(xlDown).Offset(1, 0).Value = TextBox1.Value
 
Upvote 0
Your code works for me , but try this instead

Do not need to select to put something in a cell
Start at 100 if it needs to be below 100

Code:
Cells(100, ActiveCell.Column).End(xlDown).Offset(1, 0).Value = TextBox1.Value

Valid point surely. Selection actually slows down codes and it is redundant as you have clearly demonstrated
 
Upvote 0
If your intent is to find the first blank cell then maybe
Rich (BB code):
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Offset(1, 0).Select


Test and see if your experience is any different

Tested, tested and tested again. This works every time. Many thanks for all your help.
cr
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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