jip
01-04-2013, 08:04 AM
Hi evryone, I am looking for a peace of code that will copying the text that exceeds the width of the page to the line below. I will briefly explain where im at: I have some text that I copy from a site, I paste special this in A1, now I have a list of text, all in the 1st colum (A1-aprox. A250-280) I need to fit this on 2 pages(70%). I already made a macro that will delete all the lines I do not want and all the double blanks. But I still have to copy some lines that exceed the width of the page to the line below. I would like my macro to do this aswell. I am using courier new, so the amount of characters / spaces is always the same. So if 100characters is 1 page, i want to cut evrything after the 100st to the line below.
Is this possible and if so, can someone make it for me / help me start it up.
My macro now is this:
Sub Delete()
Dim count As Integer
count = 3
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate
While ActiveCell.Row > 1
If ActiveCell.Value = "--------------------------------------------------------------------------------" Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Click on mutated (underlined) nucleotide to see the original one: " Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Click on mutated (underlined) amino acid to see the original one: " Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Be aware that some allele reference sequences may be incomplete or from cDNAs. In those cases, IMGT/JunctionAnalysis uses automatically the allele *01 for the analysis of the JUNCTION." Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Value = "" Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "2. Alignment for D-GENE and allele identification" Then
ActiveCell.Offset(-1, 0).Activate
While count = 3
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Activate
If ActiveCell.Value = "Alignment with FR-IMGT and CDR-IMGT delimitations" Then
ActiveCell.EntireRow.Delete
count = 2
End If
Wend
End If
ActiveCell.Offset(-1, 0).Activate
Wend
End Sub
Im a VBA newb so this is probably not the best way to do it, but it works great for me. So I start on top, go to the last cell and from there it goes up 1 cell at a time, and there are some if's of lines I dont want. So for text copying lines im thinking: if total characters of line > lets say 100 then cut evrything after 100 to line below. Or maybe you can use colums? evrything > column K to line below. I dont know, and i also dont know the commands, so please help me out!
Thanks in advance!
Is this possible and if so, can someone make it for me / help me start it up.
My macro now is this:
Sub Delete()
Dim count As Integer
count = 3
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate
While ActiveCell.Row > 1
If ActiveCell.Value = "--------------------------------------------------------------------------------" Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Click on mutated (underlined) nucleotide to see the original one: " Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Click on mutated (underlined) amino acid to see the original one: " Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "Be aware that some allele reference sequences may be incomplete or from cDNAs. In those cases, IMGT/JunctionAnalysis uses automatically the allele *01 for the analysis of the JUNCTION." Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Value = "" Then
ActiveCell.EntireRow.Delete
End If
If ActiveCell.Value = "2. Alignment for D-GENE and allele identification" Then
ActiveCell.Offset(-1, 0).Activate
While count = 3
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Activate
If ActiveCell.Value = "Alignment with FR-IMGT and CDR-IMGT delimitations" Then
ActiveCell.EntireRow.Delete
count = 2
End If
Wend
End If
ActiveCell.Offset(-1, 0).Activate
Wend
End Sub
Im a VBA newb so this is probably not the best way to do it, but it works great for me. So I start on top, go to the last cell and from there it goes up 1 cell at a time, and there are some if's of lines I dont want. So for text copying lines im thinking: if total characters of line > lets say 100 then cut evrything after 100 to line below. Or maybe you can use colums? evrything > column K to line below. I dont know, and i also dont know the commands, so please help me out!
Thanks in advance!