Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If statement(rookies)
Private Sub cbStart_Click()
Workbooks.Open (tbFile) Sheets(1).Activate Dim x As Integer Dim z As Integer For x = 2 To 10 Application.Goto Reference:="R" & x & "C13" ActiveCell.FormulaR1C1 = "=(LEFT(RC[-8],LEN(RC[-8])-4)+1)" ActiveCell.Value = z If z 10 Then ActiveCell.Value = "Y" Else ActiveCell.Value = "N" End If Next x ActiveWorkbook.SaveAs (tbFile) End Sub If not use the if statement , Z value will show, but if i use IF statement ,i cant use the Z value to compare with integer ,anything wrong ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If statement(rookies)
Do you mean
z = activecell.value instead of activecell.value = z ? "KK" wrote: Private Sub cbStart_Click() Workbooks.Open (tbFile) Sheets(1).Activate Dim x As Integer Dim z As Integer For x = 2 To 10 Application.Goto Reference:="R" & x & "C13" ActiveCell.FormulaR1C1 = "=(LEFT(RC[-8],LEN(RC[-8])-4)+1)" ActiveCell.Value = z If z 10 Then ActiveCell.Value = "Y" Else ActiveCell.Value = "N" End If Next x ActiveWorkbook.SaveAs (tbFile) End Sub If not use the if statement , Z value will show, but if i use IF statement ,i cant use the Z value to compare with integer ,anything wrong ? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If statement(rookies)
Sam, thanks a lot......It work....
"Sam Wilson" wrote: Do you mean z = activecell.value instead of activecell.value = z ? "KK" wrote: Private Sub cbStart_Click() Workbooks.Open (tbFile) Sheets(1).Activate Dim x As Integer Dim z As Integer For x = 2 To 10 Application.Goto Reference:="R" & x & "C13" ActiveCell.FormulaR1C1 = "=(LEFT(RC[-8],LEN(RC[-8])-4)+1)" ActiveCell.Value = z If z 10 Then ActiveCell.Value = "Y" Else ActiveCell.Value = "N" End If Next x ActiveWorkbook.SaveAs (tbFile) End Sub If not use the if statement , Z value will show, but if i use IF statement ,i cant use the Z value to compare with integer ,anything wrong ? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
If statement(rookies)
Good.
If you mark that as the answer other people can search for it and might help themselves. "KK" wrote: Sam, thanks a lot......It work.... "Sam Wilson" wrote: Do you mean z = activecell.value instead of activecell.value = z ? "KK" wrote: Private Sub cbStart_Click() Workbooks.Open (tbFile) Sheets(1).Activate Dim x As Integer Dim z As Integer For x = 2 To 10 Application.Goto Reference:="R" & x & "C13" ActiveCell.FormulaR1C1 = "=(LEFT(RC[-8],LEN(RC[-8])-4)+1)" ActiveCell.Value = z If z 10 Then ActiveCell.Value = "Y" Else ActiveCell.Value = "N" End If Next x ActiveWorkbook.SaveAs (tbFile) End Sub If not use the if statement , Z value will show, but if i use IF statement ,i cant use the Z value to compare with integer ,anything wrong ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Can I nest an 'If' statement in a 'With' statement? | Excel Programming | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |