excel - Moving Occupied Rows up above Blank ones with VBA code syntax error -


i have syntax error in if statement confused about, seems compiler shouldn't require = expected : = error on

if isempty(activecell) activecell.offset(0,-1)

range(zen).select oak = 1 oak = oak + 1 if isempty(activecell) activecell.offset(0, -1) else: if isempty(selection.offset(0, -1)) copy selection(activerow(e - m).range) paste selection.offset(0, -1) loop until oak = ruby 

here code in entirety

dim ws worksheet dim rng1 range dim ruby integer dim ruby2 integer set ws = sheets("belmont") set rng1 = ws.columns("c").find("*", ws.[c1], xlvalues, , xlbyrows, xlprevious) dim zen string zen = rng1.address(0, 0) range(zen).select ruby = activecell.row ruby2 = ruby - 11 dim stones() boolean redim stones(1 ruby) dim z integer z = 1 if isempty(activecell.offset(2, 0)) stones(z) = 0 selection.offset(-1, 0).select z = z + 1 else stones(z) = 1 selection.offset(-1, 0).select z = z + 1 end if loop until z > ruby2 range(zen).select oak = 1 oak = oak + 1 if isempty(activecell) activecell.offset(0, -1) else: if isempty(selection.offset(0, -1)) copy selection(activerow(e - m).range) paste selection.offset(0, -1) loop until oak = ruby 

activecell.offset(0, -1) invalid portion. need activecell. like: activecell.offset(0, -1).select move selection offset, or activecell.offset(0, -1) = "data value" put data offset cell.

or set range offset cell, like: set myrange = activecell.offset(0, -1)

also, should change if-then syntax little more vba friendly:

if isempty(activecell)   activecell.offset(0, -1).select elseif isempty(selection.offset(0, -1))     dim row integer     row = activecell.row     range(cells(row, 5), cells(row, 13)).select     selection.copy end if 

and activerow isn't valid in excel, above changes should want.


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -