Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How Excel help to reproduce a form like this

I want to generate a new form.
Sheet1:
Staff Att'd. Date Post JOB
CHAN 01-04-07 PA R8
WONG 01-04-07 PB IC
CHAN 01-05-07 PA IC
LEE 01-06-07 PC SP
CHAN 01-07-07 PA SP

TO THIS NEW FORM (Sheet2):
STAFF: CHAN POST: PA
DATE: JOB
01-04-07 R8
01-05-07 IC
01-07-07 SP

Thanks
GY

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default How Excel help to reproduce a form like this

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iNextRow As Long
Dim sh As Worksheet

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 2 To iLastRow
Set sh = Nothing
On Error Resume Next
Set sh = Worksheets(.Cells(i, "A").Value)
On Error GoTo 0
If sh Is Nothing Then
Set sh = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
sh.Name = .Cells(i, "A").Value
sh.Range("A1").Value = _
"STAFF: " & .Cells(i, "A").Value & " POST:" & .Cells(i,
"C").Value
sh.Range("A2").Value = "DATE:"
sh.Range("B2").Value = "POST"
iNextRow = 3
Else
iNextRow = sh.Cells(Rows.Count, "A").End(xlUp).Row + 1
End If
.Cells(i, "B").Copy sh.Cells(iNextRow, "A")
.Cells(i, "D").Copy sh.Cells(iNextRow, "B")
Next i

End With

End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"GY Fong - HK" wrote in message
...
I want to generate a new form.
Sheet1:
Staff Att'd. Date Post JOB
CHAN 01-04-07 PA R8
WONG 01-04-07 PB IC
CHAN 01-05-07 PA IC
LEE 01-06-07 PC SP
CHAN 01-07-07 PA SP

TO THIS NEW FORM (Sheet2):
STAFF: CHAN POST: PA
DATE: JOB
01-04-07 R8
01-05-07 IC
01-07-07 SP

Thanks
GY



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
Can a form made in Excel 2002 be converted into a fillable form? Paraclete Excel Discussion (Misc queries) 1 February 20th 07 09:20 PM
Can anybody reproduce my EXPLODING filesize workbooks? 100kb - 30 Philip_plf Excel Discussion (Misc queries) 2 June 13th 06 10:10 AM
how to generate a unique form # when using an excel form template PJE Excel Worksheet Functions 1 May 24th 06 11:00 PM
How do I put my information form Excel into a Word Merge Form? Jackie Excel Discussion (Misc queries) 2 March 16th 06 08:16 PM
Can anyone reproduce my Chart error? Is this an Excel BUG? Philip_plf Charts and Charting in Excel 6 February 14th 05 05:34 PM


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

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

About Us

"It's about Microsoft Excel"