VBA Excel, group rows and perform an action for each group

Lara465

New Member
Joined
Mar 29, 2020
Messages
32
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello!

I have an excel like this:
1593770575842.png


So I have column A, I want column B to complete automatically. I though that by entering a blank row between groups it will be easier to separate groups.
So it will go down the column A and for each not empty row it will write Iph in column B, when it finds an empty row on column A, it writes nothing in column B. Then continues and writes Sms for next group untill emply row, and so on.
I know how to write something for each non empty row, but it will write the same thing for the whole excel sheet, like this:
1593770679183.png

My question: is there a way to write something different after each blank row found?

Thank a lot guys.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
How many different categories do you have? I am thinking the best way to do this is create a table and then use Vlookup

time.xlsx
ABCDE
1BrandCodeIPhone 11-10iph
2IPhoneiphIPhone 11 fff pretiph
3Samsungsms 
4MotoralamotSamsung 23sms
5VerizonvrzSamsung hhh pretsms
6ATTattSamsung eeesms
7Otheroth 
8Motorala 12mot
9Motorala 13mot
10 
11Verizon 4vrz
12Verizon 5vrz
Sheet2
Cell Formulas
RangeFormula
E1:E12E1=IF(D1="","",VLOOKUP(LEFT(D1,FIND(" ",D1)-1),$A$2:$B$7,2,FALSE))
 
Upvote 0
Not many categories, the problem is I can't use the Brand. For ihpone 11 it needs to write something different than from Iphone 8. and so on, I can't group it by brand.
 
Upvote 0
So I can group only how it comes in column A. First group untill blank row -> write iph
Next
Second group untill blank row -> write .......
next..
So I need a way fom when it finds a blank space to continue and I will put the code again. Not necessarily a loop for entire excel. Just a piece that I will copy and paste as many times as I need, for as many groups. But I can;t make it to go on after the blank row...
 
Upvote 0
Cannot manipulate data in a picture. Upload using XL2BB a before and after sample so that we can work with it without having to retype your data. Make sure your data is representative in your sample of your actual file.
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,981
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top