Monday 15 August 2011

excel vba - Select Case Function with Multiple Criteria is Not Looping -


I am new to VBA and for the first time I am working with "Choose Case". To summarize, after finding the "Cast_NUM" column header and going through each line, change the number of loops (changing the number of numbers from sheet to sheet), if the match corresponds to the cust_num criteria on a particular line, then "barco" The same line below the "Company name" column will be inserted into When I compile "Barco" then only placed under the first line, it seems that looping can not be done under each row, sample below. Thanks for any help!

  XX278 Barco XX004 XX004 XX278 XX004 XX004 XX278 XX278 Dim Non-Range Dim Range Dimmable as integer Dim Y as integer v = ActiveSheet.Rows (1). ("Customer_name", LookAt: = xlPart). End (xlDown). Line - Count of numbers 1 = New = ActiveSheet.Rows (1). Find ("cust_num", LookAt: = xlPart) set 'Nu = cust_num Set column header cmp_ = ActiveSheet.Rows (1). ("Company name", LookAt: = xlPart) 'set cmpny = company name column Select y = 0 to v' loop for each line Case Nu.Offset (1 + Y, 0). "Value" line 1 + y "cust_num" episode "XX004", "XX278", "XX318" 'if' cust_num 'line = this #'s cmp.offset (1 + y, 0). Value = "barco" 'then' choose the corresponding line at the end of the company name 'column = "verse" next    

@TimWilliams now works, it uses the Select loop through the specified lines case function and determines that the criteria are set-up for that cell, If such a value is inserted on the same line on the right side of the criteria cell (in this case cust_num). Range dim as cu mode as the compressed range in the form of dim v as integer dim y, the integer v = ActiveSheet.Range ("A" and rows.Count). End (xlUp). 'Count the rows number to set the number of rows neo = activate. Rove (1). ("CUST_NUM", LookAt: = xlPart), click on 'NU = CUSTOM_NAME column header' cmpnny = ActiveSheet.Rows (1). Search ("Company Name", LookAt: = xlPart) 'cmpny = Company Name Columns Select the case Nu.Offset (1 + y, 0) for each line from y = 0 to v' loop. Value_num "Case" value value of XX004 value 1 + y "," XX278 "," XX318 "'If' cust_num 'line = this #' cmp.yoffset (1 + y, 0). Value =" barco "'company name' Select Column = "Varko" End Next

No comments:

Post a Comment