Copying a Row's data when a Column value changes - Microsoft Community
- Get link
- X
- Other Apps
hello
i have file circa 26k rows, trying run formula / macro insert new row when value changes in column b
00048-00479-07 | 48-00479 | sub sku | 5038600136367 | valid | eva | eva | classic ladies slippers | 48 | black | black | |
00048-00479-08 | 48-00479 | sub sku | 5038600136374 | valid | eva | eva | classic ladies slippers | 48 | black | black | |
00048-00479-09 | 48-00479 | sub sku | 5038600136381 | valid | eva | eva | classic ladies slippers | 48 | black | black | |
00048-00480-03 | 48-00480 | sub sku | 5038600136183 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-04 | 48-00480 | sub sku | 5038600136190 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-05 | 48-00480 | sub sku | 5038600136206 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-06 | 48-00480 | sub sku | 5038600136213 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-07 | 48-00480 | sub sku | 5038600136220 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-08 | 48-00480 | sub sku | 5038600136237 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00480-09 | 48-00480 | sub sku | 5038600136244 | valid | eva | eva | classic ladies slippers | 48 | blue | blue | |
00048-00481-03 | 48-00481 | sub sku | 5038600136251 | valid | eva | eva | classic ladies slippers | 48 | wine | wine | |
00048-00481-04 | 48-00481 | sub sku | 5038600136268 | valid | eva | eva | classic ladies slippers | 48 | wine | wine | |
00048-00481-05 | 48-00481 | sub sku | 5038600136275 | valid | eva | eva | classic ladies slippers | 48 | wine | wine | |
00048-00481-06 | 48-00481 | sub sku | 5038600136282 | valid | eva | eva | classic ladies slippers | 48 | wine | wine |
in above example, see new row added @ row 4 column b changes from 48-00479 to 48-00480 etc
how possible?, don't have great vba skills , don't want spend time doing line line
any appreciated
hi,
alt+f11 open vb editor, right click 'thisworkbook' , insert module , paste code below in on right , run it.
sub insertrowifnamechg()
dim mycolumn string, x long
mycolumn = "b"
x = cells(rows.count, mycolumn).end(xlup).row 2 step -1
if cells(x - 1, mycolumn) <> cells(x, mycolumn) rows(x).insert
next x
end sub
Office / Excel / Other/unknown / Office 365 for business
- Get link
- X
- Other Apps
Comments
Post a Comment