![]() |
Script Help?
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 |
Script Help?
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 |
All times are GMT +1. The time now is 10:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com