0

In Sheet1 i have one stagnant Column suppose Column "A" which gets copied again and again in next empty column in same Sheet

Like 1st it gets copied in Column "B" then find next empty column & copy data in Column "C"

--> Here my question is

I want to create formula in Sheet 2 in Column "A" where it make Formula with next filled column in Sheet1

Like

  1. 1st it makes calculation: Sheet1!A1/Sheet1!B1

    After few min

  2. it make formula in same Column "A" oF Sheet2: Sheet1!A1/Sheet1!C1

    After few min

so on

Sub GoToNextCol()
    Application.ScreenUpdating = False

    Dim NextCol As Long
    NextCol = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column + 1

    Sheet1.Range("A1").CurrentRegion.Copy Sheet1.Cells(1, NextCol)

    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

1 Answer 1

1

Do you mean this?

In Sheet2 cell A1

sheet2.range("a1").formula="=Sheet1!A1/Sheet1!" & cells(1,nextcol).address(0,0)
Sign up to request clarification or add additional context in comments.

3 Comments

thank you so much ..you are on my favorites list ----
what if i have to create this Formula @SJR --> =IF(Sheet1!B1>Sheet1!C1, IF(Sheet1!B1>Sheet1!D1, 2, 1),IF(Sheet1!B1<Sheet1!C1, IF(Sheet1!B1<Sheet1!D1, -2, -1),0)) & Further Column gets incremental like C & D changes to E & F ---- Then E & F Changes to G & H like this ....
It's the same principle. cells(1,nextcol).address(0,0) resolves to C1 when nextcol=3 and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.