Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Modified:- Macro to Generate a new Column!!!

i have tried to put a chunk of code ... but i m unable
to make it fit as per my problem. can u help me out!
My scenario is as follows:

PunchDate DateIn Timein DateOut Timeout Shift Dept Reg LCh OT
DT BR Total HWH Abst Remarks


The above r the columns of the Excel report generated,
i have shown them in 2 rows, otherwise all these
columns r in one row only and r generated from A-Q in
Excel sheet. i want the condition to be enforced on
TimeIn column and display the result of the condition
in a new column which shud be generated after the last
columns i.e. 'Remarks' . And Also it shud affect all the roecords till
the end of the sheet!
i tried to put on a code... but i cudn't make it! i m
doin like this... i know i m doin something stupid.

Dim MyCell As Object
For Each MyCell In Range(Cells(3, 7), Cells(3,
7).End(xlDown)).Cells
If MyCell.Value TimeSerial(10, 0, 0) Then
MyCell.Offset(0, 1).Value = TimeSerial(11, 0, 0)
Else
MyCell.Offset(0, 1).Value = ""
End If
Next


please help me out!
thanx n regards
Inder

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Modified:- Macro to Generate a new Column!!!

Slightly confused about columns but try this ...

Dim lastrow As Long
Dim irow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For irow = 2 To lastrow
If Cells(irow, "C") TimeSerial(10, 0, 0) Then
Cells(irow, "R") = TimeSerial(11, 0, 0)
Else
Cells(irow, "R").Value = ""
End If
Next irow

"Inder" wrote:

i have tried to put a chunk of code ... but i m unable
to make it fit as per my problem. can u help me out!
My scenario is as follows:

PunchDate DateIn Timein DateOut Timeout Shift Dept Reg LCh OT
DT BR Total HWH Abst Remarks


The above r the columns of the Excel report generated,
i have shown them in 2 rows, otherwise all these
columns r in one row only and r generated from A-Q in
Excel sheet. i want the condition to be enforced on
TimeIn column and display the result of the condition
in a new column which shud be generated after the last
columns i.e. 'Remarks' . And Also it shud affect all the roecords till
the end of the sheet!
i tried to put on a code... but i cudn't make it! i m
doin like this... i know i m doin something stupid.

Dim MyCell As Object
For Each MyCell In Range(Cells(3, 7), Cells(3,
7).End(xlDown)).Cells
If MyCell.Value TimeSerial(10, 0, 0) Then
MyCell.Offset(0, 1).Value = TimeSerial(11, 0, 0)
Else
MyCell.Offset(0, 1).Value = ""
End If
Next


please help me out!
thanx n regards
Inder


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
Last Modified date on cell or column Mary Excel Discussion (Misc queries) 6 May 16th 23 03:42 AM
Modified:- Macro to Generate a new Column!!! Inder Excel Worksheet Functions 1 July 10th 07 01:03 PM
Macro to generate a new column denpending upon existing one! Inder Excel Worksheet Functions 1 July 10th 07 12:21 PM
In Excel can you have a cell generate the last dated modified?? Charlene77777 Excel Discussion (Misc queries) 1 March 22nd 06 05:28 PM
How to record macro to print pages modified today pamiam3333 Excel Worksheet Functions 1 September 10th 05 02:36 AM


All times are GMT +1. The time now is 10:11 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"