Dear Divaker,

Works like a charm! Many thanks :)


On Thu, Mar 20, 2014 at 4:30 PM, Divaker Pandey <divake...@gmail.com> wrote:

> use below code
>
> Sub createSheet()
> Dim cpyRng As String, EmpCode As String, EmpDtl As String
> Dim i As Integer
> Dim totRow As Integer, RecStartRow As Integer, RecEndRow As Integer
> Dim cpyFlag As Boolean
> totRow = 190
>
> For i = 8 To totRow
> If InStr(ThisWorkbook.Sheets("Sheet1").Cells(i, 1).Value, "** Code & Name
> :-") > 0 Then
>  EmpDtl = ThisWorkbook.Sheets("Sheet1").Cells(i, 1).Value
>  RecStartRow = i
>  EmpCode = Mid(EmpDtl, InStr(EmpDtl, "-") + 4, InStr(InStr(EmpDtl, "-") +
> 4, EmpDtl, " ") - InStr(EmpDtl, "-") - 4)
> End If
>
> If InStr(ThisWorkbook.Sheets("Sheet1").Cells(i, 1).Value, "Present") > 0
> Then
>  RecEndRow = i
>  cpyFlag = True
> End If
>
> If cpyFlag = True Then
>  cpyRng = "A" & RecStartRow & ":" & "N" & RecEndRow
>  Call MakeNewSheet(cpyRng, EmpCode)
>  cpyFlag = False
> End If
> Next
>
>
> End Sub
>
>
> Sub MakeNewSheet(cpyRng As String, shtName As String)
>
> ThisWorkbook.Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name =
> shtName
>
>
> ThisWorkbook.Worksheets("Sheet1").Range("B6:K6").Copy
> ThisWorkbook.Worksheets(shtName).Range("B6:K6").PasteSpecial
>
> ThisWorkbook.Worksheets("Sheet1").Range(cpyRng).Copy
> ThisWorkbook.Worksheets(shtName).Range("A8").PasteSpecial
>
> Application.Goto ThisWorkbook.Worksheets(shtName).Range("A1"), True
> Application.CutCopyMode = False
>
>
>
> End Sub
>
>
>
> On Thu, Mar 20, 2014 at 2:27 PM, Abhishek Jain <abhishek....@gmail.com>wrote:
>
>> Dear Experts,
>>
>> Attached along is a sample workbook wherein attendance records of
>> employees are mentioned. The file is generated through a time-keeping
>> software and is always in the same format as is attached.
>>
>> I need to make separate sheets (not files, just sheets or tabs in the
>> existing file only) for each of the employees. The records can be
>> distinguished on the basis of code number and the sheets too can be named
>> as code number for all employees.
>>
>> Let me know if further details are required.
>>
>> Any and all help is hugely appreciated.
>>
>> Thanks & regards,
>>
>> Abhishek
>>
>> --
>> 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.

Reply via email to