LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cam Cam is offline
external usenet poster
 
Posts: 165
Default Really Help with existing VBA code...

Hello,

I have the following existing code which look at a column "I" and if the
word "ASC" text is present in the cell, then skip filling the data in column
I thru N for the row.
What I would like to change the code so that it will fill the data in the
cell from column I thru N that does not have "ASC" on the cell. Thanks

Old code sample:
A I J K L M N
Line# 1300 1300 1500 1500 1700 1700
001 ASC
002 x x x x x x
003 x x x x x x

skip row 2 with line# 001 cause ASC is in column I2 so skipping cell J2 thru
N2). Where x is data that the macro fill in.

New code wanted:
A I J K L M N
Line# 1300 1300 1500 1500 1700 1700
001 ASC x ASC x x x
002 x ASC x x x x
003 x x x x x x

it does not skip row 2 with line# 001, but rather fill in the missing cell
(J2, L2, M2 and N2) without "ASC" in the cell.

Here is my existing code:
Private Sub Macro()
'
Dim R1300M100(10000, 3)
Dim R1300M200(10000, 3)
Dim R1300M300(10000, 3)
Dim R1500M100(10000, 3)
Dim R1500M200(10000, 3)
Dim R1500M300(10000, 3)
Dim R1700M100(10000, 3)
Dim R1700M200(10000, 3)
Dim R1700M300(10000, 3)
Dim R1100M100(10000, 3)
Dim R1100M200(10000, 3)
Dim R1100M300(10000, 3)

With Sheets("100")
LastRowSh1 = _
.Cells(Rows.Count, "I").End(xlUp).Row
If LastRowSh1 < 1 Then
Set ColIRange = .Range(.Cells(2, "I"), _
.Cells(LastRowSh1, "I"))
For Each Cell In ColIRange
If (Cell < "ASC") And _
(.Rows(Cell.Row).Hidden = False) Then

.Range("H" & Cell.Row & ":X" & Cell.Row).ClearContents
End If
Next Cell
End If
End With

With Sheets("200")
LastRowSh2 = _
.Cells(Rows.Count, "I").End(xlUp).Row
If LastRowSh2 < 1 Then
Set ColIRange = .Range(.Cells(2, "I"), _
.Cells(LastRowSh2, "I"))
For Each Cell In ColIRange
If (Cell < "ASC") And _
(.Rows(Cell.Row).Hidden = False) Then

.Range("H" & Cell.Row & ":X" & Cell.Row).ClearContents
End If
Next Cell
End If
End With

With Sheets("300")
LastRowSh3 = _
.Cells(Rows.Count, "I").End(xlUp).Row
If LastRowSh3 < 1 Then
Set ColIRange = .Range(.Cells(2, "I"), _
.Cells(LastRowSh3, "I"))
For Each Cell In ColIRange
If (Cell < "ASC") And _
(.Rows(Cell.Row).Hidden = False) Then

.Range("H" & Cell.Row & ":X" & Cell.Row).ClearContents
End If
Next Cell
End If
End With

LastRowSh4 = Sheets("Data"). _
Cells(Rows.Count, "A").End(xlUp).Row

More code to insert data, etc.....
 
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
Really need help with existing code. Cam Excel Discussion (Misc queries) 0 August 12th 08 07:14 PM
Modify existing code to dynamic code Ixtreme Excel Programming 5 August 31st 07 11:42 AM
help with altering existing code ploddinggaltn Excel Programming 2 November 28th 06 03:35 AM
Help with existing code ploddinggaltn Excel Discussion (Misc queries) 1 November 27th 06 09:46 PM
Insert into existing code gav meredith Excel Programming 0 April 21st 04 02:43 AM


All times are GMT +1. The time now is 06:51 AM.

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"