I have a spreadsheet that needs cleaning up.
Before
Text 20060469 20060470 name name many more columns
Text 20060470 20060471 name name
Text 20060470 20060472 name name
Text 20060471 20060473 name name
After
Text 20060469 blank columns
Text 20060470 20060470 name name many more columns
Text 20060470 blank columns
Text 20060471 20060471 name name
Text 20060472 20060472 name name
Text 20060473 20060473 name name
I feel so silly not being able to code it when I can write it out
for all rows from 1 to 1000
If B432 != C432 THEN
move active selection down a row
insert a row
cut the range from C432 to AA432
paste it in the newly inserted row at C433 to AA433
delete the empty cell at A433 to B433
and move contents up
end if
end loop
The macro should look something like
Selection.EntireRow.Insert
Range("D401:AR401").Select
'the range selection should refer to the active selection
Selection.Cut
Range("D402").Select
ActiveSheet.Paste
Range("A402:C402").Select
Range("C402").Activate
Selection.Delete Shift:=xlUp
what is the syntax to select the active selection dynamically?
Thanks
Before
Text 20060469 20060470 name name many more columns
Text 20060470 20060471 name name
Text 20060470 20060472 name name
Text 20060471 20060473 name name
After
Text 20060469 blank columns
Text 20060470 20060470 name name many more columns
Text 20060470 blank columns
Text 20060471 20060471 name name
Text 20060472 20060472 name name
Text 20060473 20060473 name name
I feel so silly not being able to code it when I can write it out
for all rows from 1 to 1000
If B432 != C432 THEN
move active selection down a row
insert a row
cut the range from C432 to AA432
paste it in the newly inserted row at C433 to AA433
delete the empty cell at A433 to B433
and move contents up
end if
end loop
The macro should look something like
Selection.EntireRow.Insert
Range("D401:AR401").Select
'the range selection should refer to the active selection
Selection.Cut
Range("D402").Select
ActiveSheet.Paste
Range("A402:C402").Select
Range("C402").Activate
Selection.Delete Shift:=xlUp
what is the syntax to select the active selection dynamically?
Thanks