ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   populate form from where the cursor is (https://www.excelbanter.com/excel-worksheet-functions/168749-populate-form-where-cursor.html)

Diana Morrison

populate form from where the cursor is
 
I have a register worksheet and an 'off hold' form on separate sheets in the
same workbook. I want to place my cursor on any row in the register and
popular the form from various cells in the row in which the cursor is.
Can anyone help?
Thanks,
Diana


Diana Morrison

populate form from where the cursor is
 
found a solution with much muddling around - here it is (and yes, it works!)
Sub OnHoldForm() 'Completes the form using text from the Hold Request Row'
On Error GoTo ErrorHandler

Dim sourceWS As Worksheet
Dim rg As Long
Set sourceWS = Sheets("Register")
Worksheets("On Hold").Activate
Set mycell = Application.InputBox( _
prompt:="Go to the Register & place cursor on the Hold Request# you wish
to print (Column A)", Type:=8)
With mycell
Range("B9").Value = sourceWS.Cells(.Row, 6).Text
Range("E9").Value = sourceWS.Cells(.Row, 10).Text
Range("E11").Value = sourceWS.Cells(.Row, 3).Text
Range("B11").Value = sourceWS.Cells(.Row, 2).Text
Range("B13").Value = sourceWS.Cells(.Row, 4).Text
Range("B15").Value = sourceWS.Cells(.Row, 5).Text
Range("B18").Value = sourceWS.Cells(.Row, 6).Text
Range("B20").Value = sourceWS.Cells(.Row, 13).Text
Range("C20").Value = sourceWS.Cells(.Row, 22).Text
Range("B22").Value = sourceWS.Cells(.Row, 8).Text
Range("B24").Value = sourceWS.Cells(.Row, 15).Text
Range("B26").Value = sourceWS.Cells(.Row, 11).Text
End With
Set sourceWS = Nothing

ErrorHandler:
End Sub
thanks anyway,
Diana

"Diana Morrison" wrote:

I have a register worksheet and an 'off hold' form on separate sheets in the
same workbook. I want to place my cursor on any row in the register and
popular the form from various cells in the row in which the cursor is.
Can anyone help?
Thanks,
Diana



All times are GMT +1. The time now is 06:29 AM.

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