ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Update Sheet Where... (https://www.excelbanter.com/excel-programming/370390-vba-update-sheet-where.html)

Isildurx51

VBA Update Sheet Where...
 

I'm sorry if this thread exists, but I've looked everywhere and can'
find out how to do this. I have a set of data, B2:J2 are names o
employees. A2:A30 are dates. I have a userform that has a listbox fo
the names and a textbox for the dates. What I want to know is how I ca
make the form update my sheet where the specific date and nam
conditions are met. So, say I had info for John on 8/16/06. I wan
the form to full in that information when ok is clicked. Any ideas?
I'm sure it's simple, but I'm not that great with VBA, and I can't fin
any examples to work from. Thanks

--
Isildurx5
-----------------------------------------------------------------------
Isildurx51's Profile: http://www.excelforum.com/member.php...fo&userid=3752
View this thread: http://www.excelforum.com/showthread.php?threadid=57166


SandyUK[_28_]

VBA Update Sheet Where...
 

Not clear on what you are trying to achieve or the conditions you
mentioned can you give some more details?


--
SandyUK
------------------------------------------------------------------------
SandyUK's Profile: http://www.excelforum.com/member.php...o&userid=17487
View this thread: http://www.excelforum.com/showthread...hreadid=571663


Dave Peterson

VBA Update Sheet Where...
 
dim myCol as variant
dim myRow as variant
dim myDate as date

mydate = cdate(me.combobox1.value)

with worksheets("somesheetnamehere")
mycol = application.match(me.listbox1.value, .range("b2:J2"),0)
myRow = application.match(clng(mydate), .range("a3:a30"),0)

if isnumeric(mycol) _
and isnumeric(myrow) then
.Range("A2").offset(myrow,mycol).value = me.textbox33.value
else
beep
end if
end with

Untested, uncompiled. Watch for typos.

I think I'd use a combobox with the dates already defined from the worksheet (or
another listbox). But I'd stay away from a textbox--too much validation would
have to be done.




Isildurx51 wrote:

I'm sorry if this thread exists, but I've looked everywhere and can't
find out how to do this. I have a set of data, B2:J2 are names of
employees. A2:A30 are dates. I have a userform that has a listbox for
the names and a textbox for the dates. What I want to know is how I can
make the form update my sheet where the specific date and name
conditions are met. So, say I had info for John on 8/16/06. I want
the form to full in that information when ok is clicked. Any ideas?
I'm sure it's simple, but I'm not that great with VBA, and I can't find
any examples to work from. Thanks.

--
Isildurx51
------------------------------------------------------------------------
Isildurx51's Profile: http://www.excelforum.com/member.php...o&userid=37520
View this thread: http://www.excelforum.com/showthread...hreadid=571663


--

Dave Peterson

Isildurx51[_2_]

VBA Update Sheet Where...
 

Thanks very much. Still trying to implement the code, but I think
have a basic idea of how to do it. I'm fairly new to VBA, so I've go
a giant learning curve. :cool

--
Isildurx5
-----------------------------------------------------------------------
Isildurx51's Profile: http://www.excelforum.com/member.php...fo&userid=3752
View this thread: http://www.excelforum.com/showthread.php?threadid=57166



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

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