![]() |
Little Help with macro and boldface
Hi all, i tried to record a macro with excell that make more easy my
work, it just cut some colums and it orders some numbers, but i have a problem, the firsts colums to cut all in the same position for all appointments that i export but others are casual so the macro cannot work well because if a column is different then work is wrong. but, the starting column that i have to cut have always the same Letter the others no, in another words all colums have an intestation like: product id, price, year and so.. and it start always with "product id" but sometimes end with 3 columns ans sometime ends with 4 columns, but i'm thinking about this; the last column that i have to cut is always with intestation in Boldface, is possible ask vbs to cut from "product id" and last colum that are intested with boldface? here is the code but i stop at product id then i dont know how i can do the trick; Sub Macro1() ' ' Macro1 Macro ' Macro registrata il 08/04/2006 da Jhon ' ' Scelta rapida da tastiera: CTRL+d ' Rows("1:6").Select Selection.Delete Shift:=xlUp Cells.Select Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Columns("G:H").Select Range("H1").Activate Selection.Delete Shift:=xlToLeft ActiveCell.FormulaR1C1 = "Data precedente" Columns("I:J").Select Range("J1").Activate Selection.Delete Shift:=xlToLeft ActiveWindow.LargeScroll ToRight:=2 Range("AC25:AC29").Select ActiveWindow.SmallScroll Down:=-7 ActiveWindow.LargeScroll ToRight:=-1 Columns("V:V").Select ***** AFTER HE TO LAST BOLDFACE INTESTED COLUMN. End Sub is possible something? sorry for my english. bye all. |
Little Help with macro and boldface
Mirkoz
It's a little hard to follow what you want to do. The word "Intested" is not a word in English that I could find. Do you mean a cell that has an entry in bold font? To check if a cell has bold font, you would use something like: If ActiveCell.Font.Bold = True Then If you want to find the last column that has bold font, you would use a looping code to check each cell in one row starting from the rightmost column and going left. Once you have that last bold column you can set the range of columns you want to delete. Please post back and clarify what you want to do. HTH Otto "Mirkoz" wrote in message ups.com... Hi all, i tried to record a macro with excell that make more easy my work, it just cut some colums and it orders some numbers, but i have a problem, the firsts colums to cut all in the same position for all appointments that i export but others are casual so the macro cannot work well because if a column is different then work is wrong. but, the starting column that i have to cut have always the same Letter the others no, in another words all colums have an intestation like: product id, price, year and so.. and it start always with "product id" but sometimes end with 3 columns ans sometime ends with 4 columns, but i'm thinking about this; the last column that i have to cut is always with intestation in Boldface, is possible ask vbs to cut from "product id" and last colum that are intested with boldface? here is the code but i stop at product id then i dont know how i can do the trick; Sub Macro1() ' ' Macro1 Macro ' Macro registrata il 08/04/2006 da Jhon ' ' Scelta rapida da tastiera: CTRL+d ' Rows("1:6").Select Selection.Delete Shift:=xlUp Cells.Select Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Columns("G:H").Select Range("H1").Activate Selection.Delete Shift:=xlToLeft ActiveCell.FormulaR1C1 = "Data precedente" Columns("I:J").Select Range("J1").Activate Selection.Delete Shift:=xlToLeft ActiveWindow.LargeScroll ToRight:=2 Range("AC25:AC29").Select ActiveWindow.SmallScroll Down:=-7 ActiveWindow.LargeScroll ToRight:=-1 Columns("V:V").Select ***** AFTER HE TO LAST BOLDFACE INTESTED COLUMN. End Sub is possible something? sorry for my english. bye all. |
Little Help with macro and boldface
Hello, sorry for my stupid english, i realize is very difficult to
understand, iwe uploaded an example he http://www.q3metalclan.com/example.xls Thx for ur help. bb |
Little Help with macro and boldface
Range("D1").Select
Do While Selection.Font.Bold = True Selection.Offset(0, 1).Select Loop Range(Range("D1"), Cells(1, Selection.Column - 1)).EntireColumn.Select HTH -- AP "Mirkoz" a écrit dans le message de ups.com... Hello, sorry for my stupid english, i realize is very difficult to understand, iwe uploaded an example he http://www.q3metalclan.com/example.xls Thx for ur help. bb |
All times are GMT +1. The time now is 09:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com