Home |
Search |
Today's Posts |
#16
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, it did work. I had to clean up the work sheets. They go a little masy.
"JW" wrote: It works on my end for insterting the text. Are you receiving an error? The complete line should be: Cells(i, 1).Value = Cells(i, 1).Offset(-1, 0).Value & "Total" pgarcia wrote: Cool. But it would not inset the text part. When I removed it, it did work adding the last row in. Thanks Cells(i, 1).Value = Cells(i, 1).Offset(-1, 0).Value & " Total" "JW" wrote: Tweaked it a little. This should work for the last data in column issue and to add the "East Total" into the inserted row: Sub foorev() botrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 For i = botrow To 3 Step -1 If Cells(i, 1).Value < Cells(i, 1).Offset(-1, 0).Value Then Cells(i, 1).EntireRow.Insert Cells(i, 1).Value = Cells(i, 1).Offset(-1, 0).Value & " Total" End If Next i End Sub As for VB classes, FWIW, I've never taken a single class on VB or VBA. Everything I know is self taught. Not saying that classes are a bad thing, because they most certainly are not. But through practice and confidence, good VB skills can be acheived. pgarcia wrote: I realy need to take a VB class or two. That was great. Could I ask just two more things? The first, when it gets to the last data in the colum, it does not insert a row. And last, could I go to that emtpy cell in that colum and inset "East Total", "South Total" and "West Total"? "JW" wrote: This will cycle through all the used cells in column A, starting in row 2, and insert a blank line whenever the value changes. I believe this is what you are after. If not, just let me know. Sub foo() BotRow = Cells(Rows.Count, 1).End(xlUp).Row For i = 3 To BotRow If Cells(i, 1).Value < Cells(i, 1).Offset(-1, 0).Value Then Cells(i, 1).EntireRow.Insert BotRow = BotRow + 1 i = i + 1 End If Next i End Sub On Sep 10, 5:32 pm, pgarcia wrote: Unrelated, but do you... I have a spread sheet with 20 colums. I colum a there is a list of East, West and South. I need to go down to the last East in the list and inster a row. Same for West and South. Thanks "JW" wrote: Sub foofer() Dim r As Long r = Cells.Find(What:="Grand Total", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Row Range(Cells(r + 1, 1), Cells(65536, 1)).EntireRow.Delete End Sub pgarcia wrote: Hello agina. Thanks for the below code. I'm using this code again but for something elso. Whith the below code, how can I selecet the next row and delete all infomaton from that row on down? Thanks "JW" wrote: Is "Grand Total" only found one time in your whole worksheet? If so: Sub foofer() Dim r As Long r = Cells.Find(What:="Grand Total", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Row With Range("A" & r & ":W" & r).Font .Bold = True .Size = 12 .ColorIndex = 5 End With End Sub The above sub will do what you want without physically going to the row containing Grand Total. If you want it to do that, you could just change the .Row to a .Activate and establish the row then. HTH -Jeff- pgarcia wrote: I have a cell in D2945 (changes daily). In that cell it reads "Grand Total". I would like to be able to go to that cell, then go to the begining of that row, selece row A-W, bold, change color to blue and font 12 points. Does anyone know how to do this? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to sum cells across different worksheets in different locat | Excel Worksheet Functions | |||
Search Value If Found transfer Data in same row to specified locat | Excel Programming | |||
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON | Excel Programming | |||
How do I reference a cell as PART of a vlookup "Table_Array" locat | Excel Worksheet Functions | |||
How to create/run "cell A equals Cell B put Cell C info in Cell D | Excel Discussion (Misc queries) |