Having trouble copy pasting specific text into new column/row

jimsjoh

New Member
Joined
May 8, 2019
Messages
4
Hello, trying to automate a big spreadsheet with 1500+ rows and not having much luck when trying VBA myself.

I have 3 columns.
Column A which contain cells with "Sum of" followed by a locale code such as en_US, the locale code changes.
Following each "Sum of" cell there is a number of project rows also in Column A, amount varies.
Column B with some values that is not important for this.
Column C I want to paste the locale code for each row of the project rows.
Loop it until there are no more rows with "Sum of" cells left.

Example:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Sum of en_US[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Task1[/TD]
[TD]123[/TD]
[TD]need "en_US" here[/TD]
[/TR]
[TR]
[TD]Task2[/TD]
[TD]321[/TD]
[TD]need "en_US" here[/TD]
[/TR]
[TR]
[TD]Sum of en_GB[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Task1[/TD]
[TD]345[/TD]
[TD]need "en_GB" here[/TD]
[/TR]
</tbody>[/TABLE]

Is there a good way of doing this beside using VBA? or do anyone have an example VBA I could use to accomplish this?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi & welcome to MrExcel
How about


Excel 2013/2016
ABC
1
2Sum of en_US 
3Task1123en_US
4Task2321en_US
5Sum of en_GB
6Task1345en_GB
81
Cell Formulas
RangeFormula
C2=IF(LEFT(A1,3)="sum",MID(A1,8,100),IF(B2<>"",C1,""))
 
Upvote 0
Would you also help clarify the logic behind the function as well?
I'm trying to learn, I think I understand it but confirmation would be useful.

IF(LEFT(A1,3)="sum" - return true if the first 3 character in cell A1 from left = sum
MID(A1,8,100) - If above is true then copy the characters starting form the 8 character in cell A1
IF(B2<>"",C1,""))
- return true if B2 is smaller or bigger value than C1? which I guess would be true as long as the cell in B has a value?

Also thank you for the welcome :)
 
Upvote 0
The first two are correct, the third is saying if B2 is nothing (or empty) return C1 otherwise return nothing
 
Upvote 0
I see, was wondering how it was continuing to copy when A was not "sum", but it's clear now, thank you!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,103
Members
452,302
Latest member
TaMere

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