Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
K2G K2G is offline
external usenet poster
 
Posts: 2
Default User Form - Finding the value in an Array

Hello all,
I am developing a spreadsheet that contains a series of User Form. One
of then uses a combo box and a list box, The user selects an account
(a row in an Array) from the combo box and then he selects one item
from the list box (Column head in the array) that will receive a new
value, i.e., once he clicks the Ok button the array where the data is
will change only the selected item, leaving all the other as they were
previously. I am new to VBA, therefore having a hard time in
developing the code for doing that.
I would appreciate getting some help from anyone who has faced similar
needs.
Thanks all in advance,

K
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default User Form - Finding the value in an Array

Is this array a multicolumn range--or is it a real array (in code)?

If it's a range, you may be able to do something like:

dim myRow as Variant 'could be an error
dim myCol as Variant 'could be an error
dim myRng as range
dim myCell as range

With worksheets("Somesheetnamehere")
set myrng = .range("a1:G" & .cells(.rows.count,"A").end(xlup).row)
end with

myrow = application.match(me.combobox1.value, myrng.columns(1), 0)
myCol = application.match(me.listbox1.value, myrng.rows(1),0)

if iserror(myrow) _
or iserror(mycol) then
msgbox "Design error--there is no match!"
exit sub
end if

set mycell = myrng(myrow,mycol)

mycell.value = "This is the cell!"



K2G wrote:

Hello all,
I am developing a spreadsheet that contains a series of User Form. One
of then uses a combo box and a list box, The user selects an account
(a row in an Array) from the combo box and then he selects one item
from the list box (Column head in the array) that will receive a new
value, i.e., once he clicks the Ok button the array where the data is
will change only the selected item, leaving all the other as they were
previously. I am new to VBA, therefore having a hard time in
developing the code for doing that.
I would appreciate getting some help from anyone who has faced similar
needs.
Thanks all in advance,

K


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
K2G K2G is offline
external usenet poster
 
Posts: 2
Default User Form - Finding the value in an Array

On 10 jul, 09:29, Dave Peterson wrote:
Is this array a multicolumn range--or is it a real array (in code)?

If it's a range, you may be able to do something like:

dim myRow as Variant 'could be an error
dim myCol as Variant 'could be an error
dim myRng as range
dim myCell as range

With worksheets("Somesheetnamehere")
* set myrng = .range("a1:G" & .cells(.rows.count,"A").end(xlup).row)
end with

myrow = application.match(me.combobox1.value, myrng.columns(1), 0)
myCol = application.match(me.listbox1.value, myrng.rows(1),0)

if iserror(myrow) _
*or iserror(mycol) then
* msgbox "Design error--there is no match!"
* exit sub
end if

set mycell = myrng(myrow,mycol)

mycell.value = "This is the cell!"





K2G wrote:

Hello all,
I am developing a spreadsheet that contains a series of User Form. One
of then uses a combo box and a list box, The user selects an account
(a row in an Array) from the combo box and then he selects one item
from the list box (Column head in the array) that will receive a new
value, i.e., once he clicks the Ok button the array where the data is
will change only the selected item, leaving all the other as they were
previously. I am new to VBA, therefore having a hard time in
developing the code for doing that.
I would appreciate getting some help from anyone who has faced similar
needs.
Thanks all in advance,


K


--

Dave Peterson


Hello again Dave,
I tried out your suggestion, but I get the message that the value I am
looking for is not in the Range, which is not right...
I think you got the right idea of what I am trying to do.
If you have any other suggestion, I greatly appreciate, otherwise,
thanks anyway!!
K
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use text boxes as an array in an EXCEL user form MWJchmsn Excel Programming 2 February 25th 09 05:09 PM
Maintaing public array values in a user form Chet Excel Programming 1 October 4th 08 01:04 AM
Date field in user form & Loading a user form on opening workbook Balan Excel Programming 1 May 24th 08 03:40 PM
Passing Array of User Defined Type to Form dunnerca Excel Programming 4 December 23rd 07 09:22 PM
Finding elusive control on User Form Don Wiss Excel Programming 2 August 5th 06 02:08 AM


All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"