ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA help (Time crunch) please help (https://www.excelbanter.com/excel-programming/374668-vba-help-time-crunch-please-help.html)

Brad

VBA help (Time crunch) please help
 
I am trying to write conditional formatting for four conditions. I know that
will require a Do Loop however I need to write code for the Range to be
formatted. The Range I am looking for is A1:IV 64000. I am starting with
just the range selection code. I have tried Range.SelectAll, Range "A1:IV
64000".Select and keep getting errors. I know I am close but can't figure
out where I am getting it wrong. Please help

Otto Moehrbach

VBA help (Time crunch) please help
 
Not sure what you are doing or what your current code looks like, but there
should not be a space between, "IV" and "64000". If you need more, post
your code as well as the details of the error you are getting. When you get
an error message, click on the "Debug" button in the error box. This takes
you to the offending line of your code. Include that line in your post.
HTH Otto
"Brad" wrote in message
...
I am trying to write conditional formatting for four conditions. I know
that
will require a Do Loop however I need to write code for the Range to be
formatted. The Range I am looking for is A1:IV 64000. I am starting with
just the range selection code. I have tried Range.SelectAll, Range
"A1:IV
64000".Select and keep getting errors. I know I am close but can't figure
out where I am getting it wrong. Please help




Brad

VBA help (Time crunch) please help
 
Otto here is my struggle. I haven't worked in VBA for several years. I am
importing data into excel and I need to take that data move a column (column
L)into first column position, sort that column in ascending order and then
set up conditional row formatting on values in a certain column (column H).
The data import will be done weekly so the range of the data will grow each
week not to exceed 63500. I am really stuggling. Can you get me started in
the right direction.

"Otto Moehrbach" wrote:

Not sure what you are doing or what your current code looks like, but there
should not be a space between, "IV" and "64000". If you need more, post
your code as well as the details of the error you are getting. When you get
an error message, click on the "Debug" button in the error box. This takes
you to the offending line of your code. Include that line in your post.
HTH Otto
"Brad" wrote in message
...
I am trying to write conditional formatting for four conditions. I know
that
will require a Do Loop however I need to write code for the Range to be
formatted. The Range I am looking for is A1:IV 64000. I am starting with
just the range selection code. I have tried Range.SelectAll, Range
"A1:IV
64000".Select and keep getting errors. I know I am close but can't figure
out where I am getting it wrong. Please help





Charles Chickering

VBA help (Time crunch) please help
 
Brad, try this for starters:
Sub ManipulateData()
Dim lCell as Range
Columns("L").Cut
Columns("A").Insert
Set lCell = FindLastCell
With Range("A1",lCell).
.Sort Key1:=Range("A2"), Order1:=xlAscending,_
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=$H1<0.5"
.FormatConditions(1).Interior.ColorIndex = 4
End With
End Sub

Function FindLastCell() As Range
Dim LastColumn As Integer
Dim LastRow As Long
Dim LastCell As Range
If WorksheetFunction.CountA(Cells) 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
Set FindLastCell = Cells(LastRow, LastColumn)
Else
Set FindLastCell = Range("A1")
End If
End Function

--
Charles Chickering

"A good example is twice the value of good advice."


"Brad" wrote:

Otto here is my struggle. I haven't worked in VBA for several years. I am
importing data into excel and I need to take that data move a column (column
L)into first column position, sort that column in ascending order and then
set up conditional row formatting on values in a certain column (column H).
The data import will be done weekly so the range of the data will grow each
week not to exceed 63500. I am really stuggling. Can you get me started in
the right direction.

"Otto Moehrbach" wrote:

Not sure what you are doing or what your current code looks like, but there
should not be a space between, "IV" and "64000". If you need more, post
your code as well as the details of the error you are getting. When you get
an error message, click on the "Debug" button in the error box. This takes
you to the offending line of your code. Include that line in your post.
HTH Otto
"Brad" wrote in message
...
I am trying to write conditional formatting for four conditions. I know
that
will require a Do Loop however I need to write code for the Range to be
formatted. The Range I am looking for is A1:IV 64000. I am starting with
just the range selection code. I have tried Range.SelectAll, Range
"A1:IV
64000".Select and keep getting errors. I know I am close but can't figure
out where I am getting it wrong. Please help






All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com