My Assistant
![]() ![]() |
|
|
Jan 31 2004, 11:42 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 196 From: nh, usa |
I have a few boxes in "sheet 1" that I'd like to have auto fill in "sheet 2". is there an easy way to do this?
|
|
|
|
Jan 31 2004, 01:25 PM
Post
#2
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hello,
which kind of box? Combo? This code when put into first sheet's class module will write the value to A1 of the second sheet: CODE Private Sub ComboBox1_Change() Sheets(2).[a1] = ComboBox1 End Sub Martin |
|
|
|
Jan 31 2004, 03:38 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 196 From: nh, usa |
Sorry no..Their just "cells" w/ stuff like hours, dates.. stuff like that...Will your code work with a cell too? exactly where would I place this code?
Thanks for the help. Brian |
|
|
|
Jan 31 2004, 05:12 PM
Post
#4
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
OK, in general, this will write values from one sheet to another:
CODE Sub test() Set srcSht = Sheets("Sheet1") Set tgtSht = Sheets("Sheet2") 'will copy A1 to A1 tgtSht.[a1] = srcSht.[a1] 'will copy data in column A to column C tgtSht.Range("C1:C" & srcSht.[a65536].End(3).Row) = _ srcSht.Range("A1:A" & srcSht.[a65536].End(3).Row).Value End Sub Hit Alt + F11, Insert => Module paste the code there and experiment with it. Hope this helps for the start Martin |
|
|
|
Jan 31 2004, 09:12 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 196 From: nh, usa |
this worked on a blank form...
Sub test() Set srcSht = Sheets("Sheet1") Set tgtSht = Sheets("Sheet2") 'will copy A1 to A1 tgtSht.[N1] = srcSht.[L1] End Sub but not on my workbook. I get a runtime error 9 any ideas... did I enter this wrong? thanks Brian |
|
|
|
Feb 1 2004, 08:38 AM
Post
#6
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Maybe your sheets have different names?i
|
|
|
|
Feb 1 2004, 08:49 AM
Post
#7
|
|
|
UtterAccess Addict Posts: 196 From: nh, usa |
You're right! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/smile.gif) thanks again
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 06:46 PM |