ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop for formula on one sheet with reference from another sheet (https://www.excelbanter.com/excel-programming/416224-loop-formula-one-sheet-reference-another-sheet.html)

Valerie

Loop for formula on one sheet with reference from another sheet
 
I have a form in XL that currently prints automatically with a macro when I
enter a project number. The list of project numbers is on another sheet in
the workbook. The sheet I am working on is "Close Form" cell
'Range("D2:E2").Select' because it's a merged cell. I would like to have a
macro that writes something like "='Upload Nos'!A1" in this merged cell
looping through col A until the first blank cell in the sheet, "Upload Nos".
I don't have enough macro experience to write it. Can anyone help?

Bernie Deitrick

Loop for formula on one sheet with reference from another sheet
 
Valerie,

Sub ValPrint()
For i = 1 To Worksheets("Upload Nos").Cells(Rows.Count,1).End(xlUp).Row
Worksheets("Close Form").Cells(2,4).Value = _
Worksheets("Upload Nos").Cells(i,1).Value
Application.Calculate
Worksheets("Close Form").PrintOut
Next i
End Sub

HTH,
Bernie
MS Excel MVP


"Valerie" wrote in message
...
I have a form in XL that currently prints automatically with a macro when I
enter a project number. The list of project numbers is on another sheet in
the workbook. The sheet I am working on is "Close Form" cell
'Range("D2:E2").Select' because it's a merged cell. I would like to have a
macro that writes something like "='Upload Nos'!A1" in this merged cell
looping through col A until the first blank cell in the sheet, "Upload Nos".
I don't have enough macro experience to write it. Can anyone help?





All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com