ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please HELP me!! (https://www.excelbanter.com/excel-programming/405088-please-help-me.html)

Alpineman2

Please HELP me!!
 
I have created a userform and understand how to populate data from a single
textbox/combobox to an 'ActiveCell', however, can't figure out how to
populate data from the single textbox/combobox to an entire area that I've
selected/highlighted.
-By single textbox/combobox I mean one control to one column and/or multi
column.

Your help is much appreciated.

FSt1

Please HELP me!!
 
hi
it's usually done one control at a time. avoid activecell.
Range("A1").value=textbox1.value
Range("A2").value=textbox2.value
Range("A3").value=textbox3.value
ect.

but this requires hard coding which may be unsuitable for all situations.
if your are creating a data base with your userform then you can use
variables.
dim a as range
dim b as range
dim c as range
'this line will take you to the first empty cell in column A
set a = range("A1").end(xldown).offset(1,0)
'set the other variables
Set b = a.offset(0, 1) 'same row, 1 column to right
Set c = a.offset(0, 2) 'same row, 2 columns to right
'fill the cells
a.value=textbox1.value
b.value=textbox2.value
c.value=textbox3.value

may seem like a round about way but you have to tell xl where to go without
knowing where it's going.

post back if you need more info.
regards
FSt1

"Alpineman2" wrote:

I have created a userform and understand how to populate data from a single
textbox/combobox to an 'ActiveCell', however, can't figure out how to
populate data from the single textbox/combobox to an entire area that I've
selected/highlighted.
-By single textbox/combobox I mean one control to one column and/or multi
column.

Your help is much appreciated.



All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com