Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need help writing a simple script for the following excel file attached
I am trying to figure out a way to delete cell C4 and then have i shift the rows over to the left to lign up like the rest. This is jus a sample of over a thousand lines. Some have *, some don't. That is th rub. Thanks in advance for any help! Attachment filename: sample.xls Download attachment: http://www.excelforum.com/attachment.php?postid=50155 -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
couger77 wrote in message ...
Need help writing a simple script for the following excel file attached. I am trying to figure out a way to delete cell C4 and then have it shift the rows over to the left to lign up like the rest. This is just a sample of over a thousand lines. Some have *, some don't. That is the rub. How about: Sub Macro1() Dim iRow, lastRow As Long Dim rng 'Determine the last row Worksheets("Sheet1").Select Range("A1").Select lastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row 'For rows containing '*' in C column, replace the '*' with the 4 columns to the right For iRow = 1 To lastRow Set rng = Cells(iRow, "C") If rng.Value = "*" Then Set rng = Range(Cells(iRow, "D"), Cells(iRow, "G")) rng.Select Selection.Cut Destination:=Range(Cells(iRow, "C"), Cells(iRow, "F")) End If Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help ! How do I do this in VB Script | Setting up and Configuration of Excel | |||
Excel 2000/XP script to Excel97 script | Excel Programming | |||
VB Script help | Excel Programming | |||
Script? | Excel Programming | |||
what is a vb script | Excel Programming |