我需要在A列中放置行标题。这会因每个页面而异,所以我需要一个VBA来处理这个问题。我需要计算两个单元格之间的行数,然后对标题进行serielize。
要
所以我也需要
这是对的吗?
答案 0 :(得分:0)
(我个人认为VBA是不必要的)
您可以使用此公式从**OnCreate() :-**
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED, returnIntent);
this.finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
ActionBar mActionBar = getActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.actionbar_category_feed_list, null);
RelativeLayout rrBack = (RelativeLayout) mCustomView.findViewById(R.id.rr_back);
TextView title = (TextView) mCustomView.findViewById(R.id.txt_title);
title.setText("");
title.setTypeface(typeFaceMedium);
rrBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mTracker.send(new HitBuilders.EventBuilder().setCategory("" + userUsername).setAction("On Search Feed Screen").setLabel("Pressed Back Button").build());
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED, returnIntent);
finish();
}
});
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
**actionbar_category_feed_list.xml**
?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@android:color/white" >
<RelativeLayout
android:id="@+id/rr_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" >
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:focusable="false"
android:src="@drawable/back_red" />
</RelativeLayout>
<com.converza.library.CustomTextView
android:id="@+id/txt_title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/rr_back"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:text="@string/app_name" />
</RelativeLayout>
**At last in your fragment Activity use a OnactivityResult() for get a Returnintent from Activity.**
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Const.FEEDDETAIL && resultCode == Activity.RESULT_OK) {
Log.e(tag, "DatashBoard Const.FEEDDETAIL RESULT_OK");
} else if (requestCode == Const.FEEDDETAIL && resultCode == Activity.RESULT_CANCELED) {
Log.e(tag, "DatashBoard Const.FEEDDETAIL RESULT_CANCELED");
}
}
开始并自动填充:
A1
一些注意事项:
现在我硬编码&#34; S&#34;和&#34;检查员&#34;在这,但你可以将其改为单元格引用。让我们说=IFERROR(IF(AND(MATCH("S",B:B,0)<MATCH(B1,B:B,0),MATCH("Inspector",B:B,0)>MATCH(B1,B:B,0)),IFERROR(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),-1,0)+1,1),""),"")
和D1
(只记得使用绝对引用E1
和$D$1
:
$E$1
答案 1 :(得分:0)
能够在没有循环的情况下执行此操作
Option Explicit
Sub MarkSamples()
Dim FoundsCell As Range
Dim FoundeCell As Range
Dim cStart As String
Dim cEnd As String
Dim EndCell As String
Dim sampCol As String
Dim StartCell As String
cStart = "s" & " " & "*"
cEnd = " Inspector"
Set FoundsCell = Sheets("Sheet1").Columns(2).Find(cStart, LookIn:=xlValues, LookAt:=xlWhole)
Set FoundeCell = Sheets("Sheet1").Columns(2).Find(cEnd, LookIn:=xlValues, LookAt:=xlWhole)
StartCell = FoundsCell.row + 1
EndCell = FoundeCell.row - FoundsCell.row - 1
sampCol = "A" & StartCell
Range(sampCol) = 1
Range(sampCol).Select
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Stop:=EndCell, Trend:=False
End Sub