Add data validation imput message to offset cell

kmarinow

New Member
Joined
Dec 7, 2020
Messages
2
Office Version
  1. 2016
Hello,

Could anybody give me a help with some validation code, please?

I have vba form button which create new product on my table. It transfer all data from userform to table last row. One of the userform text_box is for item describe and text is way too long for cell so i prefer to add data validation imput message with information from my text_box userform.

This is what i have :


Dim ch As Worksheet
Set ch = ThisWorkbook.Sheets("Main")

Dim TargetRow As Integer

TargetRow = Sheets("Options").Range("Target_row") + 1 'where target_row is formula on one of my sheets

ch.Range("Item_Describe").Offset(TargetRow, 0).Value = "Item Information"

Dim ocell As Range

Set ocell = ch.Range("Item_Describe").Offset(TargetRow, 0)

With range.ocell.validation

.imputmessage = Item_describe_userform

End with

.....................

Obviously i miss something important because i tried alot of options and searched in google but i didnt find anything which can help me.

Any help will be good

Thank you!
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

kmarinow

New Member
Joined
Dec 7, 2020
Messages
2
Office Version
  1. 2016
I used this and it works . Thanks anyway!



Dim ocell As Range

Set ocell = ch.Range("Main").Offset(TargetRow, 0)


With ocell


With .Validation
.Add Type:=xlValidateInputOnly
.InputTitle = "Item info"
.InputMessage = Item_describe_userform
End With

End With
 

Watch MrExcel Video

Forum statistics

Threads
1,127,499
Messages
5,625,132
Members
416,074
Latest member
rogie111

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
Top