fuzzhead1506
Technical User
Hi,
I am new to vba and in an excel spreadsheet I'd like to search my sheet for all rows of the same type and format them in a way that would allow the sheet to be read a little easier.
I think a while loop is the best way to do this is a while loop, but if someone has a better idea by all means, let me know.
I was thinking that the code would look like this:
(note each row that I wish to format falls 30 rows after the last)
Sub RowLoop ()
Range("A31").Select
' This loop runs as long as there is a row of this type
Do While IsEmpty(ActiveCell) = False
ActiveCell.Offset(0,1).Delete Shift:=xlToRight
ActiveCell.Offset(0,2).Delete Shift:=xlToLeft
ActiveCell.Offset(0,15).Delete Shift:=xlToLeft
ActiveCell.Offset(0,17).Delete Shift:=xlToLeft
ActiveCell.Offset(0,8). “change contents to Status”
^^^ I have no clue of how to code this part ^^^
ActiveCell.Offset(30, 0).Select
Loop
End Sub
Sending the ActiveCell to A61, then A91
I haven’t gotten the code to work and I was hoping that this forum would help me do so! (Receiving mainly a global error.)
So ultimately, a row that looks like this:
|SSN| | | |Employee|Type| |Inst| |Date|Ticker|Source| |Action| |Shares| |Amount|
Will look like this:
| |SSN| |Employee| |Type| |Inst|Status|Date|Ticker|Source| |Action|Shares| |Amount| |
Any help would be greatly appreciated!
Thanks,
Matt
I am new to vba and in an excel spreadsheet I'd like to search my sheet for all rows of the same type and format them in a way that would allow the sheet to be read a little easier.
I think a while loop is the best way to do this is a while loop, but if someone has a better idea by all means, let me know.
I was thinking that the code would look like this:
(note each row that I wish to format falls 30 rows after the last)
Sub RowLoop ()
Range("A31").Select
' This loop runs as long as there is a row of this type
Do While IsEmpty(ActiveCell) = False
ActiveCell.Offset(0,1).Delete Shift:=xlToRight
ActiveCell.Offset(0,2).Delete Shift:=xlToLeft
ActiveCell.Offset(0,15).Delete Shift:=xlToLeft
ActiveCell.Offset(0,17).Delete Shift:=xlToLeft
ActiveCell.Offset(0,8). “change contents to Status”
^^^ I have no clue of how to code this part ^^^
ActiveCell.Offset(30, 0).Select
Loop
End Sub
Sending the ActiveCell to A61, then A91
I haven’t gotten the code to work and I was hoping that this forum would help me do so! (Receiving mainly a global error.)
So ultimately, a row that looks like this:
|SSN| | | |Employee|Type| |Inst| |Date|Ticker|Source| |Action| |Shares| |Amount|
Will look like this:
| |SSN| |Employee| |Type| |Inst|Status|Date|Ticker|Source| |Action|Shares| |Amount| |
Any help would be greatly appreciated!
Thanks,
Matt