ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make counter invisible (https://www.excelbanter.com/excel-programming/288278-make-counter-invisible.html)

hotherps[_6_]

Make counter invisible
 
I have the following code: (It was given by two previous respondents) I
works great!

But If I change my value From "PACK" to some other string like "ABC
can I hide the counter?
Thanks!

Dim i As Integer
Dim L 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 CEL

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


Bob Phillips[_6_]

Make counter invisible
 
What exactly do you mean by hide the counter?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"hotherps " wrote in message
...
I have the following code: (It was given by two previous respondents) It
works great!

But If I change my value From "PACK" to some other string like "ABC"
can I hide the counter?
Thanks!

Dim i As Integer
Dim L 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


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




Bob Phillips[_6_]

Make counter invisible
 
Re-reading your previous post, I guess you mean that you don't want ABC1,
ABc2, etc. you just want ABC. Correct?

If so, it is simply

Dim i As Integer
Dim L As Integer

i = 0
For Each CELL In Range("A1:DD267")
If CELL.Value = "ABC" Then
i = i + 1
For j = 0 To 7
CELL.Offset(0, j).Value = "ABC"
Next j
If i 40 Then i = 0
End If
Next CELL

Gets over the problem of a repeated number in a column<vbg


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"hotherps " wrote in message
...
I have the following code: (It was given by two previous respondents) It
works great!

But If I change my value From "PACK" to some other string like "ABC"
can I hide the counter?
Thanks!

Dim i As Integer
Dim L 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


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





All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com