Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,Friends,
Assuming i have variable no. of rows in a sheet each time i run the macro.The macro should check for the First four characters of column A in each row, Insert a worksheet in the name of those first four digits if the digits are changed in the next row and copy the Entire row to the new sheet. If any confusion in understanding the above please revert back. Regards Thyagaraj |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
something like the below should help:
Option Explicit Sub AddSheets() Dim i As Integer Dim myNarrative As String Dim myPrevNarrative As String Dim myTableSheet As Worksheet On Error Resume Next Set myTableSheet = ActiveSheet With myTableSheet For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row myNarrative = Left(.Cells(i, 1), 4) myPrevNarrative = Left(.Cells(i - 1, 1), 4) If myPrevNarrative < myNarrative Then With ActiveWorkbook.Worksheets.Add .Name = myNarrative End With .Rows(i).Copy Sheets(myNarrative).Rows(1) End If Next End With End Sub Hope this helps Jason Thyagaraj wrote: Hi,Friends, Assuming i have variable no. of rows in a sheet each time i run the macro.The macro should check for the First four characters of column A in each row, Insert a worksheet in the name of those first four digits if the digits are changed in the next row and copy the Entire row to the new sheet. If any confusion in understanding the above please revert back. Regards Thyagaraj |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP REQUIRED | Excel Discussion (Misc queries) | |||
Help Required | Excel Worksheet Functions | |||
Help Required.... | Excel Discussion (Misc queries) | |||
Help required...... | Excel Discussion (Misc queries) | |||
Help required in VBA | Excel Programming |