Another Version:
Sub GenSN()
Dim Data, lRow As Long, lNum As Long, SrcData As Range
Set SrcData = ActiveSheet.Range("A:Z").Find("S>No").CurrentRegion
Data = SrcData.Value
For lRow = 1 To UBound(Data, 1)
lNum = lNum + 1
If Not IsNumeric(Data(lRow, 1)) Then lNum = 0
If IsNumeric(Data(lRow, 1)) Then Data(lRow, 1) = lNum
Next
SrcData = Data
End Sub
Line 1: variable declaration
Line 3: tell vba to remember that var SrcData is pointing to current
activesheet on a region that contain a word "S>No" in a range from
column A to Z
Line 5: Store the value from range SrcData to array named "Data" then
used it in data operation in VBA, this will save a lot of time than if
we check each range in excel from VBA
Line 6: make a repetition from line 1 to the end of array ("Column mode")
Line 7: Start Counting a serial number to place in a row
Line 8: If on a "cell" that we check is not a number, this can be
something like a "Header-xxx" or "S>No" and etc, then reset the number
to zero
Line 9: If the cell is blank, the numeric value is zero, and that is a
number, than we store the serial number on it.
Line 10: Push back the array "Data" to SrcData range, and we done !
Rgds,
[dp]
On 15/10/2014 10:29, Pramod Singh wrote:
Hi Renukachari,
Please find the attachment as per your requirement..........
On Wed, Oct 15, 2014 at 12:10 AM, Paul Schreiner <schreiner_p...@att.net> wrote:
I'm sorry, but there's nothing in the attachment that describes any type of
"serial number".
In fact, I'm not even sure WHAT it is describing.
It seems to be a checklist of some sort.
Does it mean that the serial number is supposed to be a 21-characters and
each character can be of the values suggested?
It could not be a 21 DIGIT number because character #8 can be 2-digits.
although, one could check the length of the string and interpret a 22
character string as using two characters for the 8th value.
Is the macro supposed to CREATE a serial number, or INTERPRET it?
without more information as to what you want to accomplish, it would be
almost impossible to guess enough to provide any meaningful assistance.
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------
From: Renukachari Kasee <jva.ch...@gmail.com>
To: "excel-macros@googlegroups.com" <excel-macros@googlegroups.com>
Sent: Tuesday, October 14, 2014 2:06 PM
Subject: $$Excel-Macros$$ Serial Number macro problem
Dear Group,
Please provide the macro for serial Number as per attached sheet
Thankss
♥♥♥...♪♪♪....RenukaChari. Kasee...♥♥♥...♪♪♪
P Let us do our best to save nature, save water, plant trees, protect
greenery, keep our surroundings clean, reduce usage of plastics, and use
renewable energy sources.
--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
https://www.facebook.com/discussexcel
FORUM RULES
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security
measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
NOTE : Don't ever post confidential data in a workbook. Forum owners and
members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups
"MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.
--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
https://www.facebook.com/discussexcel
FORUM RULES
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security
measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
NOTE : Don't ever post confidential data in a workbook. Forum owners and
members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups
"MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.
--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
https://www.facebook.com/discussexcel
FORUM RULES
1) Use concise, accurate thread titles. Poor thread titles, like Please Help,
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
NOTE : Don't ever post confidential data in a workbook. Forum owners and
members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.