Rang offset question

itsupport

New Member
Joined
Aug 14, 2003
Messages
25
Hi

I have a userform that adds data in an offset(1). value method based on 3 criteria on the form (a "Task" combobox, a ""Notes" textbox and a Now() statement.

The task, notes and timestamp are added to the sheet in sequence - this works fine.

My simple but annoying issue is thus...if someone adds a "Task" but doesnt add "Notes" it leaves a blank cell in the sequence.
The next "Task" update with "Notes" added will populate the "Task" in the right place, but the "Notes" in the previous line.

Is there a way to allow users not to add notes with the offset staying in line with the "task" entry?

Code below:


Range("A10000").End(xlUp).Offset(1).Value = ComboBox1.Value
Range("b10000").End(xlUp).Offset(1).Value = TextBox1.Value
Range("c10000").End(xlUp).Offset(1).Value = Now()

MsgBox "Your entry has been recorded.", vbInformation + vbOKOnly, "Spreadsheet update"
TextBox1.Value = ""
UserForm1.Hide
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi,

One way would be to get a reference to the first free cell in column A, then to use that as a reference point to offset across the row.

Code:
    Dim rngFreeCell As Range
    
    Set rngFreeCell = Range("A10000").End(xlUp).Offset(1)
    
    rngFreeCell.Value = ComboBox1.Value
    rngFreeCell.Offset(, 1).Value = TextBox1.Value
    rngFreeCell.Offset(, 2).Value = Now()
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,428
Members
449,083
Latest member
Ava19

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