T
Tat
I am a novice at VB coding so this is probably an
elementary question.
I would like to format a range in [h]:mm: format so that I
can use it in a calculation. Right now I can use the
spreadsheet format but in order to 'activate' the format I
have to doubleclick EACH cell and then move to another
cell. There are 200 lines of data that needs to be
formatted and 'activated' so I thought a VB routine would
be more efficient.
This is what I have come up with. I have no trouble with
formatting it, it's the coding for the 'doubliclick'that I
am having problem with. Coding example:
Sub DirectTimetoCalculateTimeFormat()
'
Columns("D").Select
Selection.NumberFormat = "[h]:mm:"
End Sub
Sub DoubleClicks()
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range("d8:e300")
For Each ActiveCell In ActiveSheet
Application.DoubleClick
Application.MoveAfterReturn = False
Application.MoveAfterReturnDirection = xlDown
Next
End Sub
From what I have read the 'For Each..Next' loop is a good
statement to use however it cannot be used with a user
defined array. So, what do I do? Is there a better
statement to use?
I would like to use the same procedure for different
spreadsheets so I have saved it in personal.xls. Another
question, Do I have to define the spreadsheet in the
procedure or is it assumed when I open the Macro in the
current spreadsheet?
elementary question.
I would like to format a range in [h]:mm: format so that I
can use it in a calculation. Right now I can use the
spreadsheet format but in order to 'activate' the format I
have to doubleclick EACH cell and then move to another
cell. There are 200 lines of data that needs to be
formatted and 'activated' so I thought a VB routine would
be more efficient.
This is what I have come up with. I have no trouble with
formatting it, it's the coding for the 'doubliclick'that I
am having problem with. Coding example:
Sub DirectTimetoCalculateTimeFormat()
'
Columns("D").Select
Selection.NumberFormat = "[h]:mm:"
End Sub
Sub DoubleClicks()
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range("d8:e300")
For Each ActiveCell In ActiveSheet
Application.DoubleClick
Application.MoveAfterReturn = False
Application.MoveAfterReturnDirection = xlDown
Next
End Sub
From what I have read the 'For Each..Next' loop is a good
statement to use however it cannot be used with a user
defined array. So, what do I do? Is there a better
statement to use?
I would like to use the same procedure for different
spreadsheets so I have saved it in personal.xls. Another
question, Do I have to define the spreadsheet in the
procedure or is it assumed when I open the Macro in the
current spreadsheet?