excel vba - Replacing strings in a column sequentially -
i naive macros. have data in column 500 rows of data. note rows blank in between. data image files names (x0011@00.jpg). need rename them sequentially user input. user input must 400500. new name must (400500_image-1.jpg). _image-1, _image-2 , on must generated automatically in sequence omitting blank rows.
see below how data displayed in column , how want in column b.
i appreciate if can provide macro this.
col col b x0011@00.jpg 400500_image-1.jpg x0021@00.jpg 400500_image-2.jpg x0041@00.jpg 400500_image-3.jpg x0071@00.jpg 400500_image-4.jpg x0051@00.jpg 400500_image-5.jpg x0031@00.jpg 400500_image-6.jpg x0061@00.jpg 400500_image-7.jpg x0091@00.jpg 400500_image-8.jpg
thanks
sub naming() rowstoprocess = range("a" & rows.count).end(xlup).row j = 1 userinput = inputbox("give me text") = 1 rowstoprocess if not cells(i, 1).value = "" cells(i, 2).value = userinput & "_image-" & j & ".jpg" j = j + 1 end if next end sub
this macro creates column b desired
Comments
Post a Comment