question using visual basic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using excel spreadsheets to track sales in a business. I enter sales
data each week onto a spreadsheet and wqs given the formula below to use so
it would
automatically be entered onto a invoice I created on a separate excel sheet.
I have used this vis basic code to do that:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "AP4" Then
Worksheets("$INV1").Range("$A$22").Value = _
Target.Value
End If
If Target.Address = "AP5" Then
Worksheets("$INV1").Range("$A$23").Value = _
Target.Value
I want to copy this so it works in in multiple columns that coreespond to
past or future weeks. I will have to repeat this many times because of
different time periods and different customers . does someone know how I can
repeat the code and have it change cells
automatically so i do not have to code every cell, just as excel works when
you copy from cell to cell it adjusts the cell address. thanks for any help.
I asked this question in 'programming' but do not understand the answer.

KMF
 
Then you should stay in .programming (which is the appropriate
newsgroup), and reply to the answer describing what you don't
understand. Posting a new message just wastes the time of those who
prepare answers to a question that has already been answered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top