vba - Loop by non blank and blank cells -
good morning! im learning vba , saw code head of catering put here how perform sumif using blank cells reference? , works fine, in inverse procedure need implement. in spreadsheet counting starts in first non blank cell , goes throghout blank cells until next non blank cell reached, , input sum in last blank cell (sum cells first non blank until last blank cell , start again next non blank cell).
00:21.6 10/1/2012 1:43 false 00:21.6 01:47.7 10/1/2012 2:13 false 01:47.7 00:56.7 10/1/2012 2:49 false 00:54.9 10/1/2012 3:43 00:11.8 10/1/2012 3:43 2:34(00:56.7 +00:54.9+00:11.8) 02:10.9 10/1/2012 3:46 false 02:10.9 01:05.4 10/1/2012 3:58 false 00:55.8 10/1/2012 4:53 04:41.8 10/1/2012 4:52 00:26.3 10/1/2012 4:58 00:04.2 10/1/2012 4:58 00:15.3 10/1/2012 4:59 00:06.4 10/1/2012 4:57 00:10.7 10/1/2012 4:56 00:04.4 10/1/2012 4:56 00:04.2 10/1/2012 4:57 00:29.2 10/1/2012 4:57 00:34.5 10/1/2012 4:56 01:22.4 10/1/2012 4:55 (01:05.400:55.8+04:41.8+...+01:22.4) 00:08.1 10/1/2012 4:55 false 00:08.1 03:20.9 10/1/2012 4:51 false 03:20.9 00:56.3 10/1/2012 5:42 false 00:56.3 02:23.1 10/1/2012 5:51 01:20.6 10/1/2012 5:48 00:09.8 10/1/2012 5:49 false 03:53.5(i.e., 02:23.1+01:20.6+00:09.8) 01:40.0 10/1/2012 7:47 false 01:40.0 01:13.4 10/1/2012 8:11 false 01:13.4 00:41.6 10/1/2012 9:49 false 00:41.6 01:08.1 10/1/2012 11:56 false 01:08.1
this code walks down column, adding goes , puts answer first blank cell finds.
sub countmeblank() dim varcounter variant until activecell.value = "" varcounter = varcounter + activecell.value activecell.offset(1, 0).select loop activecell.value = varcounter 'grabs formatting last cell data time or numeric. activecell.offset(-1, 0).select selection.copy activecell.offset(1, 0).select selection.pastespecial paste:=xlpasteformats, operation:=xlnone, _ skipblanks:=false, transpose:=false application.cutcopymode = false 'then colours cell red show contrast activecell.font.color = vbred end sub
you'll need wrap in form of loop if need walk through of data @ once.
Comments
Post a Comment