Home

Need help for MACRO

%3CLINGO-SUB%20id%3D%22lingo-sub-565404%22%20slang%3D%22en-US%22%3ENeed%20help%20for%20MACRO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-565404%22%20slang%3D%22en-US%22%3EI%20have%20a%20macro%20that%20will%20select%20the%20cell%20H3%20and%20will%20automatically%20add%201%20as%20the%20content%20then%20select%20C4%20as%20the%20end%20process.%20Can%20someone%20teach%20how%20to%20do%20the%20same%20macro%20for%20every%20rows%3F%20I%20want%20the%20same%20code%20in%20every%20row%20if%20I%20use%20the%20macro.%20Please%20help%20me.%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-565404%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-565521%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20help%20for%20MACRO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-565521%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F341767%22%20target%3D%22_blank%22%3E%40Aonotsukune0622%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20this%20would%20work.%20The%20first%20one%20works%20with%20absolute%20cells%2C%20the%20later%20works%20for%20relative%20cells.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESub%20Macro1()%3CBR%20%2F%3ETem_value%20%3D%20Range(%22H3%22).Value%20%2B%201%3CBR%20%2F%3ERange(%22H3%22).Select%3CBR%20%2F%3EActiveCell.FormulaR1C1%20%3D%20Tem_value%3CBR%20%2F%3ERange(%22C4%22).Select%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESub%20Macro2()%3CBR%20%2F%3ETem_value%20%3D%20ActiveCell.Offset(0%2C%206).Value%20%2B%201%3CBR%20%2F%3EActiveCell.Offset(0%2C%206).Range(%22A1%22).Select%3CBR%20%2F%3EActiveCell.FormulaR1C1%20%3D%20Tem_value%3CBR%20%2F%3EActiveCell.Offset(1%2C%20-6).Range(%22A1%22).Select%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3C%2FLINGO-BODY%3E
Aonotsukune0622
New Contributor
I have a macro that will select the cell H3 and will automatically add 1 as the content then select C4 as the end process. Can someone teach how to do the same macro for every rows? I want the same code in every row if I use the macro. Please help me.
1 Reply

Hi @Aonotsukune0622 

Maybe this would work. The first one works with absolute cells, the later works for relative cells. 

 

Sub Macro1()
Tem_value = Range("H3").Value + 1
Range("H3").Select
ActiveCell.FormulaR1C1 = Tem_value
Range("C4").Select
End Sub


Sub Macro2()
Tem_value = ActiveCell.Offset(0, 6).Value + 1
ActiveCell.Offset(0, 6).Range("A1").Select
ActiveCell.FormulaR1C1 = Tem_value
ActiveCell.Offset(1, -6).Range("A1").Select
End Sub

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
23 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies