help with this macro

JasonLeVan

Board Regular
Joined
Feb 7, 2011
Messages
121
Below is my macro and it almost works, its only problem is I want it to search ALL of column B for a "*". if it finds one to execute the macro and repeat till all rows are checked, but i can only get it to work by going to a specific cell. Any help

Sub Macro1()
Sheets("Sheet1").Select
Range("B8").Select
Again:
If ActiveCell.Value = "" Then Exit Sub
If ActiveCell.Value = "*" Then
Number = ActiveCell.Row
Range("B" & Number).CLEAR
Description = Application.InputBox("Please enter the Descripton:", "Description")
Cost = Application.InputBox("Please enter the Cost:", "Cost")
Retail = Application.InputBox("Please enter the Retail:", "Retail")
Range("B" & Number).CLEAR
Range("G" & Number).Value = Description
Range("K" & Number).Value = Cost
Range("M" & Number).Value = Retail
ActiveCell.Offset(1, 0).Select
GoTo Again
Else
ActiveCell.Offset(1, 0).Select
GoTo Again
End If
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Give this a shot:

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description:", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost:", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail:", "Retail")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0
that works perfect, I got one more quirk I though of to add, in column e I have the item name, is there anyway to make the imput box show the item name for the row it is working on?

Give this a shot:

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description:", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost:", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail:", "Retail")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0
Something like this?

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description for " & Range("E" & i).Value & ":", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost for " & Range("E" & i).Value & ":", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail for " & Range("E" & i).Value & ":", "Retail")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0
that is perfect...thanks

Something like this?

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description for " & Range("E" & i).Value & ":", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost for " & Range("E" & i).Value & ":", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail for " & Range("E" & i).Value & ":", "Retail")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0
not sure if you can help me out again, but I am trying to get the macro you made to also look at the text in column e of the row it stops in and add the date to it. So for example if that cell reads abc then it would now read abcmm/dd or abc2/25


that is perfect...thanks
 
Upvote 0
Like this?

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description for " & Range("E" & i).Value & ":", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost for " & Range("E" & i).Value & ":", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail for " & Range("E" & i).Value & ":", "Retail")
        Range("E" & i).Value = Range("E" & i).Value & Application.Text(Date, "mm/dd")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0
perfect.........finally done
thanks man

Like this?

Code:
Public Sub JasonLeVan()
Dim i   As Long, _
    LR  As Long
LR = Range("B" & Rows.Count).End(xlUp).row
For i = 1 To LR
    If Range("B" & i).Value = "*" Then
        Range("G" & i).Value = InputBox("Please enter the Description for " & Range("E" & i).Value & ":", "Description")
        Range("K" & i).Value = InputBox("Please enter the Cost for " & Range("E" & i).Value & ":", "Cost")
        Range("M" & i).Value = InputBox("Please enter the Retail for " & Range("E" & i).Value & ":", "Retail")
        Range("E" & i).Value = Range("E" & i).Value & Application.Text(Date, "mm/dd")
        Range("B" & i).Clear
    End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top