Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default 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


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
Create loop to insert two rows after every row of data [email protected] Excel Programming 2 August 17th 07 02:09 AM
Insert Data Last Row Loop through cells Excel 2000 & 2003 jfcby[_2_] Excel Programming 5 December 15th 06 05:28 PM
Using Loop to insert a row SharonInGa[_2_] Excel Programming 3 March 8th 05 08:04 PM
Data Form Insert Count to add to Summary Sheet Matt P.[_2_] Excel Programming 6 August 26th 04 08:38 PM
Cant run insert row through loop WashoeJeff Excel Programming 1 January 23rd 04 12:48 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"