LOOP

Ciupanezul21

New Member
Joined
May 16, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
BASED ON THIS CODE, I HAVE CARRIED OUT THE FOLLOWING STEPS 1. I SELECT A SERIES OF ROWS TO BE CONCATENATED WITH SOME CRITERIA A DELIMITER / SEPARATOR BETWEEN THE SELECTED VALUES AND ALSO A START AND END CODING, BUT I WANT EACH CODING TO END. THAT IS, THE LAST LETTER AS EX:

S-1620-180-16-A

"A" APPEARS IN ALL THE SELECTED ONES....... BUT I NEED EACH ROW TO HAVE A DIFFERENT LETTER FOR EACH OPERATIONAL PHASE THAT THAT PIECE MUST HAVE.
CAN SOMEONE HELP ME CREATE FOR EACH NEXT ROW TO REPEAT TO ME THE QUESTION WHAT THE LAST LETTER SHOULD BE?
ACCORDING TO THE ATTACHED IMAGE

Captură de ecran 2023-12-09 202432.png




The VBA CODE IS:


Sub CODIFICARE()
Separator = InputBox("INTRODUCERE SEPARATOR: ", Default:="-")
Output = ""
Separator2 = InputBox("INTRODUCERE CODIFICARE PENTRU PAL BRUT/MELAMINAT ,CHERESTEA ,MDF,PLACAJ: ")

Separator3 = InputBox("INTRODUCERE NATURA CODIFICARII A- FORMA FARA GAURI SI ALTE FORME,B- FORMA CUC GAURI,C-FORMA CU GAURI SI ALTE CHESTII IN +: ")

For row_no = 1 To Selection.Rows.Count
For col_no = 1 To Selection.Columns.Count
If VarType(Selection.Cells(row_no, col_no)) = 8 Then
Output = Output + Trim(Selection.Cells(row_no, col_no)) + Separator
Else
Output = Output + Trim(Str(Selection.Cells(row_no, col_no))) + Separator
End If
Next col_no
Selection.Cells(row_no, Selection.Columns.Count + 5) = Separator2 + Separator + Trim(Mid(Output, 1, Len(Output) - 1)) + Separator + Separator3
Output = ""
Next row_no
End Sub


AND ON THE MAIN PAGE I HAVE

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Selection.Count >= 1 Then
If Not Intersect(Target, Range("H10:H190")) Is Nothing Then

Call CODIFICARE
End If
End If

If Selection.Count >= 1 Then
If Not Intersect(Target, Range("H10")) Is Nothing Then


End If
End If
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Loop from one row to another based on criteria pop up as input box
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top