View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wendy Wendy is offline
external usenet poster
 
Posts: 35
Default Trying to copy data from one workbook to another

Hi

I want to copy the daily post over to the issue, receipt, or overdue workbooks depending on which column the postal figure has been entered into. I was trying to use a button on the issue sheet, it doesn't like Range("A & LoopNo").Select and trying to get the R1C1 to change as needed.

Can you help please?

Thanks

Wendy

Sub PosttoIssue()
Dim Rowcounter As Integer 'No of entered rows
Dim LoopNo As Integer 'Loop value
Dim RefPaymt As String
Dim RefName As String


Windows("post.xls").Activate
'Application.Sheets("W1 Mon").Range("G1").Select
'ActiveCell.FormulaR1C1 = "=COUNTA(r[1]c[-5]:r[19]c[-5])" ' counts no of entered rows between B2:B20
Rowcounter = Application.Sheets("W1 Mon").Range("G1").Value 'get No of rows value store it in rowcounter

For LoopNo = 2 To Rowcounter

'c=cell

For Each c In Worksheets("W1 Mon").Range("D" & LoopNo)
If c 0 Then
Worksheets("W1 Mon").Range("A" & LoopNo, "B" & LoopNo).Select

Selection.Cut
Windows("Issue.xls").Activate

Range("A & LoopNo").Select
Windows("Issue.xls").Activate

RefPaymt = "R"& LoopNo &"C1"
RefName ="R" & LoopNo & "C2"
ActiveCell.FormulaR1C1 = _
"='[POST.xls]W1 Mon'! RefPaymt &"" ""&'[POST.xls]W1 Mon'! Refname"
End If 'c0

Next c
Next LoopNo