![]() |
Loop to insert data from a form - Help
Hi all, i have created the code below to loop through all the part numbers
intererd into txt_PrtNumber, this is working fine, but now i need to add the part description as well, i am baffled here and do not know what to do. Any help would be much appreciated. Dim vPrtNums As String, lmyAdd As Variant Dim MyNums As Variant, sPrtDescr As String, myDescr As Variant Dim i, d vPrtNums = frm_InputTM.txt_PrtNumber i = Split(vPrtNums, ",") MyNums = i If frm_InputTM.Opt_SevPartsOneSupp = True Then For Each i In MyNums If i = "" Then Else With ActiveWorkbook.ActiveSheet Range(vmyCol & vmyRow) = i Range(vmyCol & vmyRow).Offset(0, 4) = sPrtDescr Range(vmyCol & vmyRow).Offset(0, 5) = sModel End With End If vmyRow = vmyRow + 1 Next End If -- Les |
Loop to insert data from a form - Help
in your code you have this line:
vPrtNums = frm_InputTM.txt_PrtNumber should you also have a line for the sPrtDescr variable?: sPrtDescr = frm_InputTM.txt_PrtDescr J On 14 Sep, 12:40, Les wrote: Hi all, i have created the code below to loop through all the part numbers intererd into txt_PrtNumber, this is working fine, but now i need to add the part description as well, i am baffled here and do not know what to do. Any help would be much appreciated. Dim vPrtNums As String, lmyAdd As Variant Dim MyNums As Variant, sPrtDescr As String, myDescr As Variant Dim i, d vPrtNums = frm_InputTM.txt_PrtNumber i = Split(vPrtNums, ",") MyNums = i * * If frm_InputTM.Opt_SevPartsOneSupp = True Then * * * * For Each i In MyNums * * * * * * If i = "" Then * * * * * * Else * * * * * * * * With ActiveWorkbook.ActiveSheet * * * * * * * * * * Range(vmyCol & vmyRow) = i * * * * * * * * * * Range(vmyCol & vmyRow).Offset(0, 4) = sPrtDescr * * * * * * * * * * Range(vmyCol & vmyRow).Offset(0, 5) = sModel * * * * * * * * End With * * * * * * End If * * * * * * vmyRow = vmyRow + 1 * * * * Next * *End If -- Les |
All times are GMT +1. The time now is 01:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com