Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
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
Help ! How do I do this in VB Script Sean Setting up and Configuration of Excel 3 March 17th 08 12:16 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM
VB Script help Quanchi Excel Programming 3 October 6th 03 03:13 PM
Script? Scrappy[_2_] Excel Programming 1 July 21st 03 08:44 PM
what is a vb script george Excel Programming 1 July 16th 03 09:56 AM


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