Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KK KK is offline
external usenet poster
 
Posts: 61
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default 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   Report Post  
Posted to microsoft.public.excel.programming
KK KK is offline
external usenet poster
 
Posts: 61
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Can I nest an 'If' statement in a 'With' statement? DK Excel Programming 6 April 17th 09 08:26 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 07:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"