Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
WTG WTG is offline
external usenet poster
 
Posts: 11
Default Copy Cell value from one worksheet to another, then delete.

I know I've asked alot already, and I really am greatful for all the
help. I'd like to promise This is the last time, but I can't... this
is a big project for me and being a newbe to this vba and excel for
that matter I'll most likely be bothering you guys again....Sorry :)

But I am learning...........
"LOOK BOB I ONLY POSTED IN THE PROGRAMMING GROUP :D"

Thanks again for all the help you have all given me so far and yet to
come :)

Here's my new problem


I have a user form with two combo boxes.

Combo box 1 reads EmpData!A1:A100

Combo Box 2 reads EmpData!B1:B100

Then a Cmd Button

I have two work sheets one with data and one with a blank form to be
printed.

I need to be able to pick either a empolyee Number (Combo box 1) or a
Employee Name (Combo Box 2) And then click on the Command button and
have the Excel find the matching row and then copy the cells from the
row in the Empdata worksheet the Proper cell in the EmpPrt worksheet.

ie. Combo Box 1 = 4500
find the cell between A1 and A100 that matches 4500 ( Say A49)

Then copy EmpData!A49 to EmpPrt!D10
Then EmpData!b49 to EmpPrt!k5
Then EmpData!c49 to EmpPrt!A25
ect........

Then Print the Page and return it to a Blank Form.

I tried using a marco, but it's long and the command button doesn't
always run it... :(

Thanks for the help

Wally.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Cell value from one worksheet to another, then delete.

Private Sub CommandButton1_Click()
Dim idex as Long, varr as Variant
Dim sh as Worksheet, sh1 as Worksheet
Dim i as long, k as Long
idex = 0
if combobox1.ListIndex < -1 then
idex = combobox1.listindex + 1
elseif combobox2.ListIndex < -1 then
idex = combobox2.Listindex + 1
end if
if idex = 0 then exit sub
varr = Array("D10","K5","A25")
set sh = Worksheets("EmpData")
set sh1 = Worksheets("EmpPrt")
i = lbound(varr)
for k = 1 to 3
sh1.Range(varr(i)).Value = _
sh.Cells(idex,k).Value
i = i + 1
next
end Sub

This checks which combobox has a selection. Your combox click code should
ensure only one has a value or that the selections are consistent.

--
Regards,
Tom Ogilvy

"WTG" wrote in message
...
I know I've asked alot already, and I really am greatful for all the
help. I'd like to promise This is the last time, but I can't... this
is a big project for me and being a newbe to this vba and excel for
that matter I'll most likely be bothering you guys again....Sorry :)

But I am learning...........
"LOOK BOB I ONLY POSTED IN THE PROGRAMMING GROUP :D"

Thanks again for all the help you have all given me so far and yet to
come :)

Here's my new problem


I have a user form with two combo boxes.

Combo box 1 reads EmpData!A1:A100

Combo Box 2 reads EmpData!B1:B100

Then a Cmd Button

I have two work sheets one with data and one with a blank form to be
printed.

I need to be able to pick either a empolyee Number (Combo box 1) or a
Employee Name (Combo Box 2) And then click on the Command button and
have the Excel find the matching row and then copy the cells from the
row in the Empdata worksheet the Proper cell in the EmpPrt worksheet.

ie. Combo Box 1 = 4500
find the cell between A1 and A100 that matches 4500 ( Say A49)

Then copy EmpData!A49 to EmpPrt!D10
Then EmpData!b49 to EmpPrt!k5
Then EmpData!c49 to EmpPrt!A25
ect........

Then Print the Page and return it to a Blank Form.

I tried using a marco, but it's long and the command button doesn't
always run it... :(

Thanks for the help

Wally.



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
Copy cell value and delete white spaces at the end? gombi Excel Discussion (Misc queries) 1 July 18th 10 12:50 PM
Cannot Move, Copy, Insert, Rename, or Delete a Worksheet in Any Wo JG Excel Discussion (Misc queries) 6 February 4th 09 06:42 PM
checkbox to copy and delete content of a cell ash3154 Excel Discussion (Misc queries) 1 March 1st 08 02:15 PM
copy paste delete cell contents Garry Excel Discussion (Misc queries) 0 March 27th 06 08:26 PM
macro to copy and edit then delete a worksheet lschuh Excel Discussion (Misc queries) 13 July 27th 05 09:02 PM


All times are GMT +1. The time now is 11:29 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"