Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default VBA Help required..........!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default VBA Help required..........!

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP REQUIRED Ashwini Excel Discussion (Misc queries) 0 September 25th 08 10:45 AM
Help Required Safi. Excel Worksheet Functions 2 December 31st 07 11:29 PM
Help Required.... kiran Excel Discussion (Misc queries) 2 November 4th 06 11:48 AM
Help required...... Duncan Excel Discussion (Misc queries) 2 February 17th 05 10:26 PM
Help required in VBA MADS Excel Programming 4 January 10th 05 12:05 PM


All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"