Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
when I use this macro it doesn't work. Nothing happens and I don't get any
error reports. I am at a loss. Here it is.... Sub last_four_four() Dim lr4, lc4, mCnt, cnt As Long With Worksheets("last four") lr4 = .Cells(Rows.count, 2).End(xlUp).Row lc4 = .UsedRange.Columns.count + 1 mCnt = Application.CountIf(.Range("A71:A" & lr4), form6) If mCnt = 4 Then mCnt = 4 End If cnt = 1 For i = lr4 To 71 Step -1 If .Cells(i, 1) = form6 Then If cnt <= 4 Then Select Case mCnt Case Is = 1 .Range(.Cells(i, 2), .Cells(i, lc4)).Copy .Range("B9") Case Is = 2 If x = "" Then x = 10 .Range(.Cells(i, 2), .Cells(i, lc4)).Copy .Range("B&x") x = x - 1 Case Is = 3 If x = "" Then x = 11 .Range(.Cells(i, 2), .Cells(i, lc4)).Copy .Range("B&x") x = x - 1 Case Is = 4 If x = "" Then x = 12 .Range(.Cells(i, 2), .Cells(i, lc4)).Copy .Range("B&x") x = x - 1 End Select cnt = cnt + 1 End If End If Next End With End Sub Where it says form6 I was told to use a variable. I was using a number of 101. Any help would be appreciated. Thank you Eric |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Automating copy/paste/paste special when row references change | Excel Programming | |||
help w/ generic copy & paste/paste special routine | Excel Programming | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |