cut and paste

jokester

New Member
Joined
Apr 22, 2023
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi all,
I'm new to Macros and don't know much about VBA. But I want to format a large amount of data. So, the query is this, I have cells with contents in Japanese that I want to cut and paste into another cell that has its english romaji. So for example, ベツ, this is in one cell. I want to cut it and paste in another cell with a comma after. I'll paste a screen shot so you can see which cells and how i want to do that. Please help me out. Also there is like 600 of these so a loop would be great. I'm sending a small snippet of it where I have done the formatting and where the formatting has to be done so please have a look! And also I did try to do a macro recording but what it did was put ??? where the japanese was and copy the same text from recording one into the new cell where I ran the macros. Basically, did not understand that the text has to be what is in the destination cell already and copy the current cell contents into the destination with a comma after to separate the two. Also, include a code to delete the empty row after the cut and paste and loop

Jlpt kanji.xlsm
ABCDE
12112ジョウ, jouば, balocation, place
12213イン, inemployee, member, number, the one in charge
12314リツ, ritsuた(つ), ta(tsu)stand up, rise
12415カイ, kaiひら(く)、 あ(ける), hira(ku), a(keru)open, unfold, unseal
12516シュ, shuて, tehand
12617リョク、 リキ, ryoku, rikiちから, chikarapower, strength, strong, strain, bear up, exert
12718monto(u)question, ask, problem
128モンと(う)
12919daika(wari)substitute, change, convert, replace, period
130ダイか(わり)
13120mei, myouaka(rui)bright, light
132メイ、 ミョウあか(るい)
13321douugo(ku)move, motion, change
134ドウうご(く)
13522kyou, kei, kinmiyakocapital
136キョウ、 ケイ、 キンみやこ
13723moku, bokumeeye, class, look, insight, experience
Sheet1
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I think you'd help everyone to help you if you showed the before and after, not just the after. After reading your post several times, I can't imagine what it must have looked like before. Maybe the forum alters your typing, because my browser cannot find ベツ more than once (only in your explanation, not in the data), so there's no way to see where it was before.
 
Upvote 0
I think you'd help everyone to help you if you showed the before and after, not just the after. After reading your post several times, I can't imagine what it must have looked like before. Maybe the forum alters your typing, because my browser cannot find ベツ more than once (only in your explanation, not in the data), so there's no way to see where it was before.
HI! thanks for replying first of all. And that was just an example, take, "モン" for example in entry 128. Its translation is written in 127 as "mon". That is the before. The entries after 127 are the examples and before that is what I manually did and what I want to accomplish. "カイ" in entry 124 is what was written in the cell below, which I cut and pasted with a comma after, to separate its meaning, "Kai" and deleted the empty row. I did that for both the C and D columns
 
Upvote 0
I think I understand what you're looking for. Try the following on a copy of your sheet. With only 600 of these entries it should be fast enough, but if the entries get into the thousands, we may have to revisit.

VBA Code:
Option Explicit
Sub jokester()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    Set ws = Worksheets("Sheet1")  '<~~ change to actual sheet name
    Dim LRow As Long, i As Long
    LRow = ws.Cells(Rows.Count, "C").End(xlUp).Row
    For i = LRow To 3 Step -1
        If Cells(i, 3).Offset(, -1) = "" And Cells(i, 3).Offset(-1) <> "" Then
            Cells(i, 3).Offset(-1) = Cells(i, 3) & ", " & Cells(i, 3).Offset(-1)
            Rows(i).EntireRow.Delete
        End If
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Ignore post #4, use this one instead.
VBA Code:
Option Explicit
Sub jokester2()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    Set ws = Worksheets("Sheet1")  '<~~ change to actual sheet name
    Dim LRow As Long, i As Long
    LRow = ws.Cells(Rows.Count, "C").End(xlUp).Row
    For i = LRow To 3 Step -1
        If Cells(i, 3).Offset(, -1) = "" And Cells(i, 3).Offset(-1) <> "" Then
            Cells(i, 3).Offset(-1) = Cells(i, 3) & ", " & Cells(i, 3).Offset(-1)
            Cells(i, 3).Offset(-1, 1) = Cells(i, 3).Offset(, 1) & ", " & Cells(i, 3).Offset(-1, 1)
            Rows(i).EntireRow.Delete
        End If
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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