PDA

View Full Version : Solved: TextBox display columA & B



Mr.G
05-22-2009, 11:42 AM
Why doesn't this work? I am sure that is the way to display it.

TextBox1.Value = Range("A:B")

I am still new please be patient.

Thank you

Bob Phillips
05-22-2009, 11:50 AM
Because a textbox is a single item control, whereas Range("A:B") is a multi-cell object. They do not equate.

Mr.G
05-22-2009, 11:58 AM
thought I was being a daft.

Is there a way display columA & B on a userform?

mdmackillop
05-22-2009, 12:26 PM
You probably need to limit the number of rows in your selection A:B is a very long list. Can you post a sample workbook and explain what you are trying to do?

Mr.G
05-22-2009, 12:40 PM
Still working on this and still have a lot Q's....but doing one step at a time. And trying to keep it simple.

What I would like this part to do... when you "search Serial no." you find it display that serial numbers service history.

Hope you can help. If you see space for improvement on what I have ,any help will be appreciated.

mdmackillop
05-22-2009, 01:39 PM
You could explain what you are searching, what goes in the combobox, what is meant to happen when found.
Please take time to provide a meaningful sample if you want us to spend time helping.

georgiboy
05-22-2009, 01:45 PM
Have a look at this...

Hope this helps

jolivanes
05-22-2009, 07:35 PM
georgiboy, mdmackillop, xld
To set my own mind at ease, is there something wrong with going this way?



Me.svcHist1.Value = Range(x).Offset(, 1).Value & " - " & Range(x).Offset(, 2).Value & " - " & Range(x).Offset(, 3).Value


Thanks
John

Mr.G
05-22-2009, 11:40 PM
Hi Thank you for the help...........I am a bit scared to post that again. So here is the original idea I had.
http://www.vbaexpress.com/forum/showthread.php?t=26802

Creating a simple thing I can do. This is a bit over my head. I am determined to learn though.

Thank you again for your time.

Bob Phillips
05-23-2009, 01:59 AM
georgiboy, mdmackillop, xld
To set my own mind at ease, is there something wrong with going this way?



Me.svcHist1.Value = Range(x).Offset(, 1).Value & " - " & Range(x).Offset(, 2).Value & " - " & Range(x).Offset(, 3).Value


Thanks
John

No that is perfectly valid concatenating each cell of the range to load it. It does meant that each cell is not directlt addressable, but nothing wrong at all.

jolivanes
05-23-2009, 07:20 AM
Thanks Bob for looking at it.
Appreciate it.

John

rbrhodes
05-23-2009, 07:10 PM
Hi Mr G.

Brushing up on my Userforms...

mdmackillop
05-24-2009, 08:40 AM
Give this a try

Mr.G
05-24-2009, 11:23 PM
Thank you....thank you...thank you.

mdmackillop. Just wondering why doesn't it do the hyperlink to the last sheet. It seems to have skipped that. I posted a thread regarding that but had no replies. Is it possible?

Thank you for helping.

rbrhodes.
Doesn't look like you need brushing up. Thanks for that.

Mr.G
05-24-2009, 11:48 PM
rbrhodes

Could I ask what does this term mean or what does it refer to..... If TextBox6.Value <> "" Then
.Range("B" & roe) = TextBox6.Value
If I try to run the Userform it gives me a...
Run-time error '1004':
Method 'range' of 'object'_worksheet failed


Regards
G

mdmackillop
05-25-2009, 05:30 AM
Please add this as the last line of the CommandButton3 code

UserForm_Initialize

Mr.G
05-25-2009, 05:33 AM
Thank you for all the help.....If I can one day, I hope I can repay.....

Mr.G
05-25-2009, 05:38 AM
mdmackillop...!!!!

That works great.......Thank you thank you.

rbrhodes
05-25-2009, 11:10 AM
Hi Mr G.,

This code:
If TextBox6.Value <> "" Then
.Range("B" & roe) = TextBox6.Value


is using a 'With' statement to reference the sheet named 'Index' and a public variable (roe) to pass the row number to the Sub.

The first line checks the textbox to see if it is blank

The second line puts the (non-blank) value on the Sheet 'Index' in Column B in the row where the Search sub found the client info.

In other words, Edit client button calls the Search sub, the Search Sub finds the client info on sheet 'Index', saves the row number as 'roe' and calls the userForm sub to put the values on the sheet.

Interestingly enough I coudn't replicate your problem...

Cheers,

dr

Mr.G
05-25-2009, 11:23 AM
Thank you for explaining.....

I'll keep fiddling with your code until it works. I'll let you know if I find why it was doing that.

Thanks again.