Posts by jolivanes
-
-
We should not be advertising other sites but I hope it is allowed in this case.
-
Marsa,
Please dont start a new question in an existing thread. This is known as Thread hi-jacking. Start your own thread. Its Free! If you need to, you can link back to the thread that you thought might have been helpful.
This is from the Forum Rules.
-
http://www.snb-vba.eu/alfabet_en.html
look under the "p" for pixels
-
Thank you for letting us know that all is working as you want.
Good luck and stay safe
-
If you do want to do it after, this will do that.
Code- Sub Delete_Red_Cell_Columns()
- Dim i As Long
- Application.ScreenUpdating = False
- For i = Cells(8, Columns.Count).End(xlToLeft).Column To 1 Step -1 '<---- Change the 8 to a 7 for Row #7
- If Cells(8, i).Interior.Color = vbRed Then Cells(8, i).EntireColumn.Delete '<---- Change the 8 to a 7 for Row #7
- Next i
- Application.ScreenUpdating = True
- End Sub
-
Which code are you referring to? The code from Post #9 or Post #10?
If it is from Post #10, change this line
to this
If it is for the code from Post #9, it is mentioned on how to proceed at the end of that Post.
If you want to keep the cells red and have a separate macro to delete the Columns later, after checking maybe, let us know.
-
Multiple values in one go.
Code- Sub Maybe_Multiple_Values()
- Dim i As Long, delArr, j As Long
- delArr = Array("line", "group", "Heading") '<---- Put all the values to be deleted between double quotation marks in the array
- For i = Cells(8, Columns.Count).End(xlToLeft).Column To 1 Step -1 '<---- Change the 8 to a 7 for Row #7
- For j = LBound(delArr) To UBound(delArr)
- If Left(Cells(8, i), Len(delArr(j))) = delArr(j) Then Cells(8, i).Interior.Color = vbRed: Exit For '<---- Change both 8's to a 7 for Row #7
- Next j
- Next i
- End Sub
-
I assumed you mean Row 8 to be the Row in question.
If it is Row #7, change all the referenced cell numbers from 8 to 7
Right now it colors the cells red so you can check if the code does what you want it to do.
Code- Sub Maybe()
- Dim i As Long, strWord As String
- strWord = Application.InputBox("Enter the word to search for.", "Delete the columns with this word", Type:=2)
- For i = Cells(8, Columns.Count).End(xlToLeft).Column To 1 Step -1 '<---- Change the 8 to a 7 for Row #7
- If Left(Cells(8, i), Len(strWord)) = strWord Then Cells(8, i).Interior.Color = vbRed '<---- Change both 8's to a 7 for Row #7
- Next i
- End Sub
If you're happy, change this line
to
For future considerations.
Header rows are normally the Top Row unless specified to be different.
-
You say "the first word of a sentence".
I understand that to mean the first word of a string in a cell. Maybe not so.
As I previously asked, explain in detail or the best thing to do is attach a realistic workbook. Change privacy values if they exist in the workbook (names, addresses, email addresses and what have you)
-
Re: *Your code does not work
Yes it does.
Attach a workbook.
-
This is how I understand your request.
Code- Sub As_Per_Explanation()
- Dim lc As Long, lr As Long, strWord As String, i As Long, c As Range
- lc = Cells.Find("*", , , , xlByColumns, xlPrevious).Column
- lr = Cells.Find("*", , , , xlByRows, xlPrevious).Row
- strWord = Application.InputBox("Enter the word to search for.", "Delete the columns with this word", Type:=2)
- Application.ScreenUpdating = False
- For i = lc To 1 Step -1
- For Each c In Cells(1, i).Resize(lr).SpecialCells(2)
- If Left(c, Len(strWord)) = strWord Then c.EntireColumn.Delete: Exit For
- Next c
- Next i
- Application.ScreenUpdating = True
- End Sub
BTW, deleting Rows and/or Columns should be done by startind at the end and work your way back to the beginning (Row 1 or Column 1)
-
Maybe
Rephrase your request. It does not make sense, to me anyway
Remember, you know your workbook/spreadsheet. We're just guessing by what you tell us.
The best thing is to explain in detail what you want to achieve or attach a workbook with a before and after with an explanation on how you got the "after".
Put your code between tags. Highlight your code and click on the < / > (without spaces) at the top of your post.
-
Do you manually enter the "y" into Column K?
Is that going to be the only value in the whole of Column K? Nothing higher up or lower down?
I assume that the "k" will be in the same row that needs to be transferred.
When you say "entire row", why not just the used cells in that row?
The reason I say this is to get you used to NOT use entire rows and/or columns as this will bloat your file size when using it with formats etc.
-
-
You cannot have a macro enabled workbook named "Destination.xlsx"
It has to be either the older Excel version(.xls) or the current extension .xlsm
-
Add a copy of your workbook with private data like names, addresses etc changed.
Note:
Instead of using quote around your code, use the "</>" . If you hover your mouse button over it you'll see it says "code".
-
-
Don't know for sure but this might be what you're attempting.
I assumed that "Report" is the Sheet where you want to "deposit" the data?
Check and change references where required.
Code- Sub Maybe()
- Dim rngArr, rngArrVals, i As Long, sh1 As Worksheet, ws As Worksheet
- rngArr = Array("B6", "B8", "B10", "B11", "B12", "B13", "P28")
- ReDim rngArrVals(UBound(rngArr))
- Set sh1 = Worksheets("Report")
- For Each ws In Worksheets
- If ws.Name <> "Report" Then
- For i = LBound(rngArr) To UBound(rngArr)
- rngArrVals(i) = ws.Range(rngArr(i)).Value
- Next i
- sh1.Cells(Rows.Count, 7).End(xlUp).Offset(1).Resize(UBound(rngArrVals) + 1) = Application.Transpose(rngArrVals)
- ReDim rngArrVals(UBound(rngArr))
- End If
- Next ws
- End Sub
-
Thanks for letting us know.
Glad that it works for you also.
Good Luck elsuji