-
Solved: Reformatting a WorkSheet
Hello there.
I have attached a small sample wrkbk.
Originally Sheet ! and Sheet 2 each conatined rows of the exact same length. This is because each Sheet is used to keep track of a particular property of a data center item.
On sheet 1 we have the power and on sheet 2 we have its performance.
I have manually gone into Sheet 1 and placed the "$" symbol in certain locations to make future coding easier.
Now I would like to make Sheet 2 follow suit. That is, I need a to write a code that will look at Sheet 1 and insert a "$" symbol onto Sheet 2 wherever necessary and then "shift" the data on sheet 2 accordingly.
Sheet 3 shows the desired effect done by hand.
Thanks!
-
I believe, as in efficient as it may be, this works. I tested it on the sample book. I just need to write a quick check.
[vba]Sub Test()
For i = 1 To 3
For j = 1 To 32
If Worksheets("Sheet1").Cells(i, j) = "$" Then
Worksheets("Sheet2").Cells(i, j).Insert Shift:=xlToRight
Worksheets("Sheet2").Cells(i, j) = Worksheets("Sheet1").Cells(i, j)
End If
Next j
Next i
End Sub
[/vba]
-
Can Anyone see why this would be failing me?
It works on my first WorkSheet, but then things get kind of whacky on the others??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules