coserria
03-26-2008, 11:37 AM
Ok I have a macro that i have that is working great. but what I need to do it link the next macro that I need to run. I'm in need of using this macro.
I need it to select column b and column d.
If someone can help me that would be great.
I would also like to know how to tell it Column 2 and column 4.
on day I will understand how it works. I'm starting to understand. I have been using the help center and it does a bit for me.
I also need to know how to call a macro to run. I will be running one called "Sub CopyFromWorksheets()" that I need to call up and run.
I'm going to link three Subs together. I saw it in a post this morning but I can't remember which one it was in, I know it is simple. sorry for asking simple questions.
I saw it like this
Sub CopyFromWorksheets()
'do some stuff
Call Sub
'do some more stuff
End sub
I think?
Lastly what is the best way to save a way for a person that is completely not in the know. to run a series or macros. by a tool bar. or should I add to an exsisting area or the workbook?
Sub FillColBlanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim rng As Range
Dim lastrow As Long
Dim col As Long
Set wks = ActiveSheet
With wks
'col = ActiveCell.Column
Set rng = .UsedRange 'try to reset the lastcell
lastrow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Nothing
On Error Resume Next
Set rng = .Range(.Cells(2, col), .Cells(lastrow, col)) _
.Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "No blanks found"
Exit Sub
Else
rng.FormulaR1C1 = "=R[-1]C"
End If
'replace formulas with values
With .Cells(1, col).EntireColumn
.Value = .Value
End With
End With
End Sub
I need it to select column b and column d.
If someone can help me that would be great.
I would also like to know how to tell it Column 2 and column 4.
on day I will understand how it works. I'm starting to understand. I have been using the help center and it does a bit for me.
I also need to know how to call a macro to run. I will be running one called "Sub CopyFromWorksheets()" that I need to call up and run.
I'm going to link three Subs together. I saw it in a post this morning but I can't remember which one it was in, I know it is simple. sorry for asking simple questions.
I saw it like this
Sub CopyFromWorksheets()
'do some stuff
Call Sub
'do some more stuff
End sub
I think?
Lastly what is the best way to save a way for a person that is completely not in the know. to run a series or macros. by a tool bar. or should I add to an exsisting area or the workbook?
Sub FillColBlanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim rng As Range
Dim lastrow As Long
Dim col As Long
Set wks = ActiveSheet
With wks
'col = ActiveCell.Column
Set rng = .UsedRange 'try to reset the lastcell
lastrow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Nothing
On Error Resume Next
Set rng = .Range(.Cells(2, col), .Cells(lastrow, col)) _
.Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "No blanks found"
Exit Sub
Else
rng.FormulaR1C1 = "=R[-1]C"
End If
'replace formulas with values
With .Cells(1, col).EntireColumn
.Value = .Value
End With
End With
End Sub