'How to select a card in a set of stock cards before entering data?
I downloaded a macro from Get Digital Help:
Sub AddText()
Dim Lrow As Single
Lrow = Worksheets ("Sheet 1").Range("B" & Rows.Count).End(xlUp).Row+1
Worksheets("Sheet 1").Range("B & Lrow & ":C" & Lrow)=Worksheets("Sheet 1").Range("B3:C3").Value
This works for a single card. However I have numerous cards and need to select the appropriate card before using a macro like the above.
The information below may clarify the situation.
I am working on a set of stock control cards (68 individual cards) which have input columns "B" for the quantity sold and column "C" for the date sold.
The quantity and dates are to be picked from cells "P1" for the quantity and "Q1" for the date.
The stock card to be selected for the input comes from cell "R7". this cell gives the item number (i.e. the card number to have the entry made).
The existing macro below selects the correct stock card numbered in range "R7" and places the cursor on the first entry row in column "B".
I now need to enter the quantity sold and date in the next empty row down.
I cannot get the cursor to move beyond
Worksheets("Nail Cards").Range("C2:C4012").Find(Range("R7").Value.Select
The following last part of the macro is what I thought would input the data into the appropriate cells but does not appear to do anything.
Lrow=Worksheets("Nail Cards").Range("B & Rows.Count).End(xlUp).Row+1
Worksheets("Nail Cards").Range("B" & Lrow & ":C" & Lrow)=Worksheets ("Nail Cards").Range("P1:Q1).Value
End Sub
Solution 1:[1]
Using
Lrow = Worksheets("Nail Cards").Range("B" & Rows.Count).End(xlUp).Row + 1
Worksheets("Nail Cards").Range("B" & Lrow & ":C" & Lrow) = Worksheets("Nail Cards").Range("P1:Q1").Value
will insert the data from the range P1:Q1 on the sheet named "Nail Cards" to the next empty cells in columns B and C
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Doug Robbins |
