vba - Copying All columns based on specific IF statement -


i'm having issue line of code in debugger:

sheets("datadetail").range(cells(2, 80)).copy 

i trying copy columns in datadetail(worksheet) based on if user "olive thompson" in column1 of datadetail. however, doesn't column copy. i'd range of column cells dynamic if possible.

here code below.

sub copycolumns()   dim variant   dim lastrow long, erow long   application.screenupdating = false   application.enableevents = false   sheets("trackerdetail").rows("2:" & rows.count).clearcontents   lastrow = sheets("datadetail").cells(rows.count, 2).end(xlup).row   = 2 lastrow     if sheets("datadetail").cells(i, 1) = "oliver thompson"       sheets("datadetail").range(cells(2, 80)).copy        erow = sheets("trackerdetail").cells(rows.count, 1).end(xlup).offset(1, 0).row       sheets("datadetail").paste destination:=worksheets("trackerdetail").cells(erow, 1)     end if   next   application.cutcopymode = false   sheets("trackerdetail").columns().autofit   range("a1").select   application.enableevents = true   application.screenupdating = true   dayleftsort end sub   sub dayleftsort()    '    ' dayleftsort macro    ' sorts tracker tab days left    '    ' keyboard shortcut: ctrl+d    '    cells.select   activeworkbook.worksheets("trackerdetail").sort.sortfields.clear   activeworkbook.worksheets("trackerdetail").sort.sortfields.add key:=range("n2:n1000") _      , sorton:=xlsortonvalues, order:=xlascending, dataoption:=xlsortnormal    activeworkbook.worksheets("trackerdetail").sort      .setrange range("a1:af1000")      .header = xlyes      .matchcase = false      .orientation = xltoptobottom      .sortmethod = xlpinyin      .apply    end  end sub 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -