Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy cell value and delete white spaces at the end? | Excel Discussion (Misc queries) | |||
Cannot Move, Copy, Insert, Rename, or Delete a Worksheet in Any Wo | Excel Discussion (Misc queries) | |||
checkbox to copy and delete content of a cell | Excel Discussion (Misc queries) | |||
copy paste delete cell contents | Excel Discussion (Misc queries) | |||
macro to copy and edit then delete a worksheet | Excel Discussion (Misc queries) |