![]() |
Use Command Button from each Row to fill UserForm
I am new to VBA and need help on this issue that would be greatly
appreciated. I have a UserForm that has lots of text boxes (44) that I need to use to update cells in each row. I have a macro that puts a CommandButton at the beginning of each row with a caption name EDIT. I want the user to be able to click the EDIT button, and the UserForm pops up with all the data from that row the edit button is located on to be already in it. I also want the user to be able to edit the data in each cell using the UserForm textboxes, then click the "Apply" CommandButton to update the cells. The code I use for applying EDIT CommandButtons is below. Sub AddbtnEdit_Click() 'Adds Edit button to each row in Column A Dim cell As Range Dim btnEdit With Sheets("Global Production Schedule") LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For Each cell In Range(.Cells(3, "A"), .Cells(LastRow, "A")) Set btnEdit = .Buttons.Add(cell.Left, cell.Top, cell.Width, cell.Height) btnEdit.Caption = "Edit" & cell.Row btnEdit.OnAction = "AddbtnEdit" Next cell End With End Sub THANKS IN ADAVANCE!! |
All times are GMT +1. The time now is 06:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com