View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
hotherps[_5_] hotherps[_5_] is offline
external usenet poster
 
Posts: 1
Default New to vba trying to assign # to strings

Here is the code at the moment :Sub Button1_Click()
Dim i As Integer

i = 0
For Each cell In Range("A1:DD267")
If cell.Value = "PACK" Then
i = i + 1
For j = 0 To 7
cell.Offset(0, j).Value = "Pack" & CStr(i)
Next j
If i 40 Then i = 0
End If
Next cell

End Sub
Sub Button2_Click()
Dim i As Integer
Dim intcounter As Integer

intcounter = 0
For Each cell In Range("A1:DD267")
If cell.Value = "LVD" Then
intcounter = intcounter + 1
For j = 0 To 7
cell.Offset(0, j).Value = "LVD" & intcounter
Next j
If intcounter 8 Then intcounter = 0
End If
Next cell
End Sub


I'm using two command buttons two start the code. I'd like to be able
to consolidate these actions together. I also have other codes that I
would like the same result for. However I want to hide the counter on
every task other than "Pack"


---
Message posted from http://www.ExcelForum.com/