Adjust criteria to depend on multiple values

时间:2015-06-30 13:43:44

标签: vba excel-vba excel

I have been working on a code to copy the data from one specific range(always the same) and paste in another spreadsheet always in the row below. So basically, it starts pasting on row 11, but if I run again it will paste on the row 12 and there it goes.. The code has been working fine, but there is only one problem. It identifies the next empty row(to paste) based on the value of the column AP, but i want it to identify based on the values of all the columns between AP:BA. Thus, if there is any value on those cells, it should copy on the row below, not only if there is a value on AP. Does someone know how to change my code in order to solve this problem? Thank You very much

Sub Copy_Shanghai()    
Dim count As Integer

count = 11     

Do While Worksheets("Time Evolution").Range("AP" & count).Value <> ""


'<>"" means "is not empty", as long as this happens we go down looking for empty cell
    count = count + 1
  Loop
  'Now count is row with first empty cell outside of top 10 rows in column C

  Worksheets("Fill").Range("E5:P5").Copy
  Worksheets("Time Evolution").Range("AP" & count).PasteSpecial xlPasteValues

End Sub

0 个答案:

没有答案