PDA

View Full Version : Solved: If a cell is full



pster
05-18-2007, 07:59 AM
I have a question,

I have a macro that copies a sheet from a specific workbook and then i want a macro that creates a column wich if the first cell (for example A1) is there anything written there, in colum AC from the same row will be a formula.

is that possible?

tkx

lucas
05-18-2007, 08:38 AM
It's not clear what you mean by creates a column....
if A1 has data then enter formula in AC:
If Range("A1").Value <> 0 Then Range("AC1").Formula = "=S1"

pster
05-18-2007, 09:23 AM
Would be something like that, but I need to do in all the cells from column "A"

Simon Lloyd
05-18-2007, 10:12 AM
Something like this
Dim Rng,Mycell As Range
Dim Rng1 As String
Rng1=Range("A65536").End(xlUP).Address
Set Rng=Range("A:" & Rng1)
For Each Mycell in Rng
If Mycell.value <>0 Then Mycell.Offset(0,104).Formula = "=S1"
End If
Next Mycell

lucas
05-18-2007, 11:32 AM
or:
Dim BeginRow As Long
Dim EndRow As Long
Dim chkcol As Long
Dim ROWCNT As Long
BeginRow = 1
EndRow = 6000
chkcol = 1
For ROWCNT = BeginRow To EndRow
If Cells(ROWCNT, chkcol).Value <> "" Then
Cells(ROWCNT, "AC").Formula = "=S1"
End If
Next ROWCNT

pster
05-18-2007, 11:36 AM
Tkx lucas! Thats what i was trying 2 do!

solveD!