Hello,
I am writing a VBA code but I am getting stuck. Essentially with this code, i am selecting a file and the macro is re-organizing it.
There is one for Company Number, Company Name, Wage(number amount), Social Media Page(X,Insta,Facebook, etc.).
There are multiple lines of the same company number and name, but with a different social media page.
Essentially, I want, if there are multiple lines of the same company but with a different social media page, to half whatever is in the wage column, but if there is just one company with just a single line, then do not half whatever is in the wage, just leave it be.
This is the code where it declares what each cell value is, and then if there is a company number, then print each in each cell
If ActiveCell.Value <> "" Then
coNum = ActiveCell.Value
co = ActiveCell.Offset(0, 1).Value
wage = ActiveCell.Offset(0, 2).Value
socialMedia = ActiveCell.Offset(0, 3).Value
Worksheets("Test_File").Select
Worksheets("Test_File").Range("A65536").End(xlUp).Select
If workRow2 = 0 Then
workRow2 = ActiveCell.Row
End If
Worksheets("Test_File").Range("a" & workRow2).Select
If coNum <> "" Then
ActiveCell.Value = coNum
ActiveCell.Offset(0, 1).Value = co
ActiveCell.Offset(0, 2).Value = wage
ActiveCell.Offset(0, 3).Value = wage / 2
ActiveCell.Offset(0, 4).Value = socialMedia
nextRow = 1
workRow2 = workRow2 + 1
But with this, it is going to half the wage for every thing. Even the companies that only have one line.
I am writing a VBA code but I am getting stuck. Essentially with this code, i am selecting a file and the macro is re-organizing it.
There is one for Company Number, Company Name, Wage(number amount), Social Media Page(X,Insta,Facebook, etc.).
There are multiple lines of the same company number and name, but with a different social media page.
Essentially, I want, if there are multiple lines of the same company but with a different social media page, to half whatever is in the wage column, but if there is just one company with just a single line, then do not half whatever is in the wage, just leave it be.
This is the code where it declares what each cell value is, and then if there is a company number, then print each in each cell
If ActiveCell.Value <> "" Then
coNum = ActiveCell.Value
co = ActiveCell.Offset(0, 1).Value
wage = ActiveCell.Offset(0, 2).Value
socialMedia = ActiveCell.Offset(0, 3).Value
Worksheets("Test_File").Select
Worksheets("Test_File").Range("A65536").End(xlUp).Select
If workRow2 = 0 Then
workRow2 = ActiveCell.Row
End If
Worksheets("Test_File").Range("a" & workRow2).Select
If coNum <> "" Then
ActiveCell.Value = coNum
ActiveCell.Offset(0, 1).Value = co
ActiveCell.Offset(0, 2).Value = wage
ActiveCell.Offset(0, 3).Value = wage / 2
ActiveCell.Offset(0, 4).Value = socialMedia
nextRow = 1
workRow2 = workRow2 + 1
But with this, it is going to half the wage for every thing. Even the companies that only have one line.