ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to make the formula (https://www.excelbanter.com/excel-programming/350505-how-make-formula.html)

EXCEL NEWS

how to make the formula
 
hi,

i want to make a formula like this

cells(0,0)=sumif(range1.AddressLocal,TEXT,range2.A ddressLocal) in vba

but in excel the text must be like "ego",insteadof ego,

how to make the to be "ego" instead of ego.

thanks

Bob Phillips[_6_]

how to make the formula
 
You cannot use cells(0,0) as Cells is 1 based.

Cells(1, 1) = "=sumif(" & range1.AddressLocal & ",""TEXT""," &
range2.AddressLocal & ")"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"EXCEL NEWS" wrote in message
...
hi,

i want to make a formula like this

cells(0,0)=sumif(range1.AddressLocal,TEXT,range2.A ddressLocal) in vba

but in excel the text must be like "ego",insteadof ego,

how to make the to be "ego" instead of ego.

thanks




EXCEL NEWS

how to make the formula
 
c1.Offset(n1 + 2 + m + 1, D).Formula = "=" + "SUMIF(" + Range(c1.Offset(n1 +
2, D - 1), c1.Offset(n1 + 2 + m - 1, D -1)).AddressLocal(RowAbsolute:=False,
ColumnAbsolute:=False) + ","D16"," +Range(c1.Offset(n1 + 2, D), c1.Offset(n1
+ 2 + m - 1,
D)).AddressLocal(RowAbsolute:=False, ColumnAbsolute:=False) + ")"

if  i input ","D16",",the statement will be in red, it is error.
what should i do


thanks



"Bob Phillips" wrote in message
...
You cannot use cells(0,0) as Cells is 1 based.

Cells(1, 1) = "=sumif(" & range1.AddressLocal & ",""TEXT""," &
range2.AddressLocal & ")"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"EXCEL NEWS" wrote in message
...
hi,

i want to make a formula like this

cells(0,0)=sumif(range1.AddressLocal,TEXT,range2.A ddressLocal) in vba

but in excel the text must be like "ego",insteadof ego,

how to make the to be "ego" instead of ego.

thanks





EXCEL NEWS

how to make the formula
 
i get it,

that is chr(34)

thanks


"EXCEL NEWS" wrote in message
...
c1.Offset(n1 + 2 + m + 1, D).Formula = "=" + "SUMIF(" + Range(c1.Offset(n1

+
2, D - 1), c1.Offset(n1 + 2 + m - 1,

D -1)).AddressLocal(RowAbsolute:=False,
ColumnAbsolute:=False) + ","D16"," +Range(c1.Offset(n1 + 2, D),

c1.Offset(n1
+ 2 + m - 1,
D)).AddressLocal(RowAbsolute:=False, ColumnAbsolute:=False) + ")"

if  i input ","D16",",the statement will be in red, it is error.
what should i do


thanks



"Bob Phillips" wrote in message
...
You cannot use cells(0,0) as Cells is 1 based.

Cells(1, 1) = "=sumif(" & range1.AddressLocal & ",""TEXT""," &
range2.AddressLocal & ")"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"EXCEL NEWS" wrote in message
...
hi,

i want to make a formula like this

cells(0,0)=sumif(range1.AddressLocal,TEXT,range2.A ddressLocal) in vba

but in excel the text must be like "ego",insteadof ego,

how to make the to be "ego" instead of ego.

thanks






Bob Phillips[_6_]

how to make the formula
 
Because you are not double-quoting a string. It should be

Dim sFormula As String
Dim c1 As range

Set c1 = ActiveCell
sFormula = "=" + "SUMIF(" + _
range(c1.Offset(n1 + 2, d - 1), _
c1.Offset(n1 + 2 + m - 1, d - 1)).AddressLocal( _
RowAbsolute:=False, _
ColumnAbsolute:=False) + ",D16," + _
range(c1.Offset(n1 + 2, d), c1.Offset(n1 + 2 + m - 1,
d)).AddressLocal( _
RowAbsolute:=False, _
ColumnAbsolute:=False) + ")"

c1.Offset(n1 + 2 + m + 1, d).Formula = sFormula

if D16 is a cell, or

Dim sFormula As String
Dim c1 As range

Set c1 = ActiveCell
sFormula = "=" + "SUMIF(" + _
range(c1.Offset(n1 + 2, d - 1), _
c1.Offset(n1 + 2 + m - 1, d - 1)).AddressLocal( _
RowAbsolute:=False, _
ColumnAbsolute:=False) + "",D16,"" + _
range(c1.Offset(n1 + 2, d), c1.Offset(n1 + 2 + m - 1,
d)).AddressLocal( _
RowAbsolute:=False, _
ColumnAbsolute:=False) + ")"

c1.Offset(n1 + 2 + m + 1, d).Formula = sFormula

if D16 is text

--

HTH

RP
(remove nothere from the email address if mailing direct)


"EXCEL NEWS" wrote in message
...
c1.Offset(n1 + 2 + m + 1, D).Formula = "=" + "SUMIF(" + Range(c1.Offset(n1

+
2, D - 1), c1.Offset(n1 + 2 + m - 1,

D -1)).AddressLocal(RowAbsolute:=False,
ColumnAbsolute:=False) + ","D16"," +Range(c1.Offset(n1 + 2, D),

c1.Offset(n1
+ 2 + m - 1,
D)).AddressLocal(RowAbsolute:=False, ColumnAbsolute:=False) + ")"

if  i input ","D16",",the statement will be in red, it is error.
what should i do


thanks



"Bob Phillips" wrote in message
...
You cannot use cells(0,0) as Cells is 1 based.

Cells(1, 1) = "=sumif(" & range1.AddressLocal & ",""TEXT""," &
range2.AddressLocal & ")"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"EXCEL NEWS" wrote in message
...
hi,

i want to make a formula like this

cells(0,0)=sumif(range1.AddressLocal,TEXT,range2.A ddressLocal) in vba

but in excel the text must be like "ego",insteadof ego,

how to make the to be "ego" instead of ego.

thanks









All times are GMT +1. The time now is 01:07 PM.

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